socsvn commit: r272791 - soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw

dpl at FreeBSD.org dpl at FreeBSD.org
Thu Aug 21 19:00:31 UTC 2014


Author: dpl
Date: Thu Aug 21 19:00:30 2014
New Revision: 272791
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272791

Log:
  Corrected some GEP instructions, and removed the args and chain from the object instantiation.

Modified:
  soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc

Modified: soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc
==============================================================================
--- soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc	Thu Aug 21 18:26:32 2014	(r272790)
+++ soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc	Thu Aug 21 19:00:30 2014	(r272791)
@@ -298,11 +298,11 @@
 
 		// m = args->m (idx: 0)
 		m = irb.CreateAlloca(mbufPtrTy);
-		irb.CreateStore(irb.CreateInBoundsGEP(args, ConstantInt::get(int32Ty, 0)), m);
+		irb.CreateStore(irb.CreateInBoundsGEP(irb.CreateLoad(args), ConstantInt::get(int32Ty, 0)), m);
 
 		// ip = (struct ip *)((m)->m_data) (idx: 2)
 		ip = irb.CreateAlloca(ipPtrTy);
-		irb.CreateStore(irb.CreateBitCast(irb.CreateInBoundsGEP(args, ConstantInt::get(int32Ty, 2)), ipPtrTy), ip);
+		irb.CreateStore(irb.CreateBitCast(irb.CreateInBoundsGEP(irb.CreateLoad(args), ConstantInt::get(int32Ty, 2)), ipPtrTy), ip);
 
 #ifdef __FreeBSD__
 		ucred_cache = irb.CreateAlloca(ucredPtrTy); // Init: NULL if type ucred.
@@ -330,7 +330,7 @@
 		proto = irb.CreateAlloca(int8Ty);
 		irb.CreateStore(ConstantInt::get(int8Ty, 0), proto);
 		// args->f_id.proto = 0 (idx: 6, 5)
-		irb.CreateStore(ConstantInt::get(int8Ty, 0), irb.CreateInBoundsGEP(args, {ConstantInt::get(int32Ty, 6), ConstantInt::get(int32Ty, 5)} ));
+		irb.CreateStore(ConstantInt::get(int8Ty, 0), irb.CreateInBoundsGEP(irb.CreateLoad(args), {ConstantInt::get(int32Ty, 6), ConstantInt::get(int32Ty, 5)} ));
 
 		src_port = irb.CreateAlloca(int16Ty);
 		irb.CreateStore(ConstantInt::get(int16Ty, 0), src_port);
@@ -703,7 +703,7 @@
 	}
 
 	public:
-	ipfwJIT(struct ip_fw_args *args, struct ip_fw_chain *chain): irb(con)
+	ipfwJIT(): irb(con)
 	{
 		// Create the module and load the code.
 		mod = loadbc("ip_fw_rules.bc");
@@ -731,7 +731,7 @@
 
 		// Get struct types, and store vars
 		setEnv();
-		allocaAndInit(args, chain);
+		allocaAndInit();
 
 		emit_check_tag();
 		emit_pullup_failed();
@@ -843,7 +843,7 @@
 	InitializeNativeTarget();
 	LLVMLinkInJIT();
 
-	ipfwJIT compiler(args, chain);
+	ipfwJIT compiler;
 
 	// Fill up needed local variables.
 	compiler.emit_lookpkt_call();


More information about the svn-soc-all mailing list