Added support for creatiing an LLVMExecutionEngine with custom memory manager.
--- a/LLVMExecutionEngine.st Sun Feb 07 09:03:23 2016 +0000
+++ b/LLVMExecutionEngine.st Mon Feb 08 19:02:53 2016 +0000
@@ -93,6 +93,35 @@
"Created: / 10-07-2015 / 15:47:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 14-08-2015 / 13:08:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+newForModule: module options: options
+ | eePtr errmsgPtr |
+ self assert: (module isKindOf: LLVMModule).
+ self assert: (options isKindOf: LLVMMCJITCompilerOptions).
+ self initializeIfNotAlready.
+ eePtr := ExternalBytes new: ExternalBytes sizeofPointer.
+ errmsgPtr := ExternalBytes new: ExternalBytes sizeofPointer.
+
+ (LLVM CreateMCJITCompilerForModule: eePtr _: module _: options _: options size _: errmsgPtr) ifTrue:[
+ | errmsg err |
+
+ errmsg := errmsgPtr pointerAt: 1.
+ err := Error newException.
+ err messageText: 'Cannot create execution engine: ', errmsg copyCStringFromHeap.
+ LLVM DisposeMessage: errmsg.
+ err signal.
+ ] ifFalse:[
+ | ee |
+
+ ee := eePtr pointerAt: 1.
+ ee := LLVMExecutionEngine basicNew setAddress: ee address.
+ ee setModule: module.
+ ee initialize.
+ ^ ee
+ ].
+
+ "Created: / 08-02-2016 / 16:49:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LLVMExecutionEngine methodsFor:'accessing'!
--- a/LLVMMCJITCompilerOptions.st Sun Feb 07 09:03:23 2016 +0000
+++ b/LLVMMCJITCompilerOptions.st Mon Feb 08 19:02:53 2016 +0000
@@ -15,7 +15,7 @@
"{ NameSpace: Smalltalk }"
-LLVMObject subclass:#LLVMMCJITCompilerOptions
+ExternalBytes variableByteSubclass:#LLVMMCJITCompilerOptions
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
@@ -42,13 +42,20 @@
!LLVMMCJITCompilerOptions class methodsFor:'accessing'!
-libraryName
+new
+ ^ self new: self sizeof
- OperatingSystem isUNIXlike ifTrue:[^nil].
+ "Created: / 08-02-2016 / 13:53:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
- OperatingSystem isMSWINDOWSlike ifTrue:[^nil].
+new: size
+ | options |
+ self assert: size == self sizeof.
+ options := super new: size.
+ LLVM InitializeMCJITCompilerOptions: options _: size.
+ ^ options
- self error:'Library name for host OS is not known'
+ "Created: / 08-02-2016 / 13:53:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
sizeof
@@ -94,17 +101,20 @@
MCJMM
"Returns ;; Line: 3675
(typedef
- LLVMMCJITMemoryManagerRef
- (pointer-to ;; Line: 4082
+ LLVMMCJITMemoryManagerRef
+ (pointer-to ;; Line: 4082
;; Class: LLVMOpaqueMCJITMemoryManager
))"
- ^self at:1 + 16
+ ^self pointerAt:1 + 16
+
+ "Modified: / 08-02-2016 / 13:57:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
MCJMM: value
+ self pointerAt:1 + 16 put:value
- self at:1 + 16 put:value
+ "Modified: / 08-02-2016 / 13:57:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
NoFramePointerElim
--- a/LLVMTypeError.st Sun Feb 07 09:03:23 2016 +0000
+++ b/LLVMTypeError.st Mon Feb 08 19:02:53 2016 +0000
@@ -40,3 +40,10 @@
"
! !
+!LLVMTypeError class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
--- a/Make.proto Sun Feb 07 09:03:23 2016 +0000
+++ b/Make.proto Mon Feb 08 19:02:53 2016 +0000
@@ -143,6 +143,7 @@
$(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)
+$(OUTDIR)LLVMMCJITCompilerOptions.$(O) LLVMMCJITCompilerOptions.$(H): LLVMMCJITCompilerOptions.st $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(STCHDR)
$(OUTDIR)LLVMMetadataKind.$(O) LLVMMetadataKind.$(H): LLVMMetadataKind.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(STCHDR)
$(OUTDIR)LLVMModuleFlagBehavior.$(O) LLVMModuleFlagBehavior.$(H): LLVMModuleFlagBehavior.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(STCHDR)
$(OUTDIR)LLVMObjectArray.$(O) LLVMObjectArray.$(H): LLVMObjectArray.st $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(STCHDR)
@@ -159,7 +160,6 @@
$(OUTDIR)LLVMContext.$(O) LLVMContext.$(H): LLVMContext.st $(INCLUDE_TOP)/jv/llvm_s/LLVMObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)LLVMDiagnosticInfo.$(O) LLVMDiagnosticInfo.$(H): LLVMDiagnosticInfo.st $(INCLUDE_TOP)/jv/llvm_s/LLVMObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)LLVMDisposableObject.$(O) LLVMDisposableObject.$(H): LLVMDisposableObject.st $(INCLUDE_TOP)/jv/llvm_s/LLVMObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)LLVMMCJITCompilerOptions.$(O) LLVMMCJITCompilerOptions.$(H): LLVMMCJITCompilerOptions.st $(INCLUDE_TOP)/jv/llvm_s/LLVMObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)LLVMMetadata.$(O) LLVMMetadata.$(H): LLVMMetadata.st $(INCLUDE_TOP)/jv/llvm_s/LLVMMetadataKind.$(H) $(INCLUDE_TOP)/jv/llvm_s/LLVMObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)LLVMPassRegistry.$(O) LLVMPassRegistry.$(H): LLVMPassRegistry.st $(INCLUDE_TOP)/jv/llvm_s/LLVMObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)LLVMTargetLibraryInfo.$(O) LLVMTargetLibraryInfo.$(H): LLVMTargetLibraryInfo.st $(INCLUDE_TOP)/jv/llvm_s/LLVMObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
--- a/Make.spec Sun Feb 07 09:03:23 2016 +0000
+++ b/Make.spec Mon Feb 08 19:02:53 2016 +0000
@@ -68,6 +68,7 @@
LLVMIntPredicate \
LLVMLandingPadClauseTy \
LLVMLinkage \
+ LLVMMCJITCompilerOptions \
LLVMMetadataKind \
LLVMModuleFlagBehavior \
LLVMObjectArray \
@@ -84,7 +85,6 @@
LLVMContext \
LLVMDiagnosticInfo \
LLVMDisposableObject \
- LLVMMCJITCompilerOptions \
LLVMMetadata \
LLVMPassRegistry \
LLVMTargetLibraryInfo \
@@ -144,6 +144,7 @@
$(OUTDIR_SLASH)LLVMIntPredicate.$(O) \
$(OUTDIR_SLASH)LLVMLandingPadClauseTy.$(O) \
$(OUTDIR_SLASH)LLVMLinkage.$(O) \
+ $(OUTDIR_SLASH)LLVMMCJITCompilerOptions.$(O) \
$(OUTDIR_SLASH)LLVMMetadataKind.$(O) \
$(OUTDIR_SLASH)LLVMModuleFlagBehavior.$(O) \
$(OUTDIR_SLASH)LLVMObjectArray.$(O) \
@@ -160,7 +161,6 @@
$(OUTDIR_SLASH)LLVMContext.$(O) \
$(OUTDIR_SLASH)LLVMDiagnosticInfo.$(O) \
$(OUTDIR_SLASH)LLVMDisposableObject.$(O) \
- $(OUTDIR_SLASH)LLVMMCJITCompilerOptions.$(O) \
$(OUTDIR_SLASH)LLVMMetadata.$(O) \
$(OUTDIR_SLASH)LLVMPassRegistry.$(O) \
$(OUTDIR_SLASH)LLVMTargetLibraryInfo.$(O) \
--- a/bc.mak Sun Feb 07 09:03:23 2016 +0000
+++ b/bc.mak Mon Feb 08 19:02:53 2016 +0000
@@ -85,6 +85,7 @@
$(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)
+$(OUTDIR)LLVMMCJITCompilerOptions.$(O) LLVMMCJITCompilerOptions.$(H): LLVMMCJITCompilerOptions.st $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(STCHDR)
$(OUTDIR)LLVMMetadataKind.$(O) LLVMMetadataKind.$(H): LLVMMetadataKind.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
$(OUTDIR)LLVMModuleFlagBehavior.$(O) LLVMModuleFlagBehavior.$(H): LLVMModuleFlagBehavior.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
$(OUTDIR)LLVMObjectArray.$(O) LLVMObjectArray.$(H): LLVMObjectArray.st $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(STCHDR)
@@ -101,7 +102,6 @@
$(OUTDIR)LLVMContext.$(O) LLVMContext.$(H): LLVMContext.st $(INCLUDE_TOP)\jv\llvm_s\LLVMObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)LLVMDiagnosticInfo.$(O) LLVMDiagnosticInfo.$(H): LLVMDiagnosticInfo.st $(INCLUDE_TOP)\jv\llvm_s\LLVMObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)LLVMDisposableObject.$(O) LLVMDisposableObject.$(H): LLVMDisposableObject.st $(INCLUDE_TOP)\jv\llvm_s\LLVMObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)LLVMMCJITCompilerOptions.$(O) LLVMMCJITCompilerOptions.$(H): LLVMMCJITCompilerOptions.st $(INCLUDE_TOP)\jv\llvm_s\LLVMObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)LLVMMetadata.$(O) LLVMMetadata.$(H): LLVMMetadata.st $(INCLUDE_TOP)\jv\llvm_s\LLVMMetadataKind.$(H) $(INCLUDE_TOP)\jv\llvm_s\LLVMObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)LLVMPassRegistry.$(O) LLVMPassRegistry.$(H): LLVMPassRegistry.st $(INCLUDE_TOP)\jv\llvm_s\LLVMObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)LLVMTargetLibraryInfo.$(O) LLVMTargetLibraryInfo.$(H): LLVMTargetLibraryInfo.st $(INCLUDE_TOP)\jv\llvm_s\LLVMObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
--- a/libInit.cc Sun Feb 07 09:03:23 2016 +0000
+++ b/libInit.cc Mon Feb 08 19:02:53 2016 +0000
@@ -44,6 +44,7 @@
_LLVMIntPredicate_Init(pass,__pRT__,snd);
_LLVMLandingPadClauseTy_Init(pass,__pRT__,snd);
_LLVMLinkage_Init(pass,__pRT__,snd);
+_LLVMMCJITCompilerOptions_Init(pass,__pRT__,snd);
_LLVMMetadataKind_Init(pass,__pRT__,snd);
_LLVMModuleFlagBehavior_Init(pass,__pRT__,snd);
_LLVMObjectArray_Init(pass,__pRT__,snd);
@@ -60,7 +61,6 @@
_LLVMContext_Init(pass,__pRT__,snd);
_LLVMDiagnosticInfo_Init(pass,__pRT__,snd);
_LLVMDisposableObject_Init(pass,__pRT__,snd);
-_LLVMMCJITCompilerOptions_Init(pass,__pRT__,snd);
_LLVMMetadata_Init(pass,__pRT__,snd);
_LLVMPassRegistry_Init(pass,__pRT__,snd);
_LLVMTargetLibraryInfo_Init(pass,__pRT__,snd);