[vmkit-commits] [vmkit] r198242 - remove the llvm types from J3Class

Gael Thomas gael.thomas at lip6.fr
Mon Dec 30 11:47:59 PST 2013


Author: gthomas
Date: Mon Dec 30 13:47:58 2013
New Revision: 198242

URL: http://llvm.org/viewvc/llvm-project?rev=198242&view=rev
Log:
remove the llvm types from J3Class

Modified:
    vmkit/branches/mcjit/include/j3/j3class.h
    vmkit/branches/mcjit/lib/j3/vm/j3class.cc

Modified: vmkit/branches/mcjit/include/j3/j3class.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3class.h?rev=198242&r1=198241&r2=198242&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3class.h (original)
+++ vmkit/branches/mcjit/include/j3/j3class.h Mon Dec 30 13:47:58 2013
@@ -169,6 +169,7 @@ namespace j3 {
 		J3ObjectType(J3ClassLoader* loader, const vmkit::Name* name);
 
 		uint32_t                   logSize() { return sizeof(uintptr_t) == 8 ? 3 : 2; }
+		llvm::Type*                llvmType();
 
 		J3InterfaceSlotDescriptor* slotDescriptorAt(uint32_t index) { return &_interfaceSlotDescriptors[index]; }
 		void                       prepareInterfaceTable();
@@ -188,8 +189,6 @@ namespace j3 {
 	class J3Layout : public J3ObjectType {
 		friend class J3Class;
 
-		llvm::Type*       _llvmType;
-
 		size_t            nbFields;
 		J3Field*          fields;
 		
@@ -209,7 +208,6 @@ namespace j3 {
 
 		J3Method*         findMethod(const vmkit::Name* name, const vmkit::Name* sign);
 		J3Field*          findField(const vmkit::Name* name, const J3Type* type);
-		llvm::Type*       llvmType() { return _llvmType; }
 	};
 
 	class J3StaticLayout : public J3Layout {
@@ -220,8 +218,6 @@ namespace j3 {
 		J3Class* cl() { return _cl; }
 
 		virtual bool      isStaticLayout() { return 1; }
-
-		llvm::Type*       llvmType();
 	};
 
 	class J3Class : public J3Layout {
@@ -251,7 +247,6 @@ namespace j3 {
 
 		void          fillFields(J3Field** fields, size_t n);
 
-		void          createLLVMTypes();
 		void          doNativeName();
 
 		void          doResolve(J3Field* hiddenFields, size_t nbHiddenFields);
@@ -284,7 +279,6 @@ namespace j3 {
 		J3Method*           methodAt(uint16_t idx, uint16_t access);
 		J3Field*            fieldAt(uint16_t idx, uint16_t access);
 
-		llvm::Type*         llvmType();
 		llvm::GlobalValue*  llvmDescriptor(llvm::Module* module);
 
 		J3ClassBytes*       bytes() { return _bytes; }

Modified: vmkit/branches/mcjit/lib/j3/vm/j3class.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3class.cc?rev=198242&r1=198241&r2=198242&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3class.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3class.cc Mon Dec 30 13:47:58 2013
@@ -147,6 +147,10 @@ J3ObjectType* J3Type::asObjectType() {
 J3ObjectType::J3ObjectType(J3ClassLoader* loader, const vmkit::Name* name) : J3Type(loader, name) {
 }
 
+llvm::Type* J3ObjectType::llvmType() {
+	return loader()->vm()->typeJ3ObjectPtr;
+}
+
 J3Method* J3ObjectType::findVirtualMethod(const vmkit::Name* name, const vmkit::Name* sign, bool error) {
 	J3::internalError(L"should not happe: %ls::%ls\n", J3ObjectType::name()->cStr(), name->cStr());
 }
@@ -243,10 +247,6 @@ J3StaticLayout::J3StaticLayout(J3ClassLo
 	_cl = cl;
 }
 
-llvm::Type* J3StaticLayout::llvmType() {
-	return loader()->vm()->typeJ3ObjectPtr;
-}
-
 J3Layout::J3Layout(J3ClassLoader* loader, const vmkit::Name* name) : J3ObjectType(loader, name) {
 }
 
@@ -448,10 +448,6 @@ void J3Class::doResolve(J3Field* hiddenF
 
 		if(!J3Cst::isInterface(access()) && !J3Cst::isAbstract(access()))
 			prepareInterfaceTable();
-
-		//fprintf(stderr, "virtual part of %ls: ", name()->cStr());
-		//llvmType()->getContainedType(0)->dump();
-		//fprintf(stderr, "\n");
 	}
 	unlock();
 }
@@ -587,10 +583,6 @@ void J3Class::readClassBytes(J3Field* hi
 	fillFields(pFields2, i2);
 	fillFields(pFields1, i1);
 	fillFields(pFields0, i0);
-
-	//fprintf(stderr, "static part of %ls: ", name()->cStr());
-	//staticLayout.llvmType()->getContainedType(0)->dump();
-	//fprintf(stderr, "\n");
 	
 	size_t     nbVirtualMethods = 0, nbStaticMethods = 0;
 
@@ -815,27 +807,6 @@ void J3Class::doNativeName() {
 	loader()->addSymbol(_nativeName, this);
 }
 
-void J3Class::createLLVMTypes() {
-	J3Mangler mangler(this);
-
-	mangler.mangle("static_")->mangle(name());
-
-	_llvmType = loader()->vm()->typeJ3ObjectPtr;
-
-	doNativeName();
-}
-
-llvm::Type* J3Class::llvmType() {
-	llvm::Type* res = _llvmType;
-
-	if(!res) {
-		createLLVMTypes();
-		res = _llvmType;
-	}
-
-	return res;
-}
-
 void J3Field::dump() {
 	printf("Field: %ls %ls::%ls (%d)\n", type()->name()->cStr(), layout()->name()->cStr(), name()->cStr(), access());
 }
@@ -927,6 +898,7 @@ llvm::Type* J3ArrayClass::llvmType() {
 																																			body,
 																																			_nativeName));
 	}
+	//return loader()->vm()->typeJ3ObjectPtr;
 	return _llvmType;
 }
 





More information about the vmkit-commits mailing list