From 3e5a3dce4556f48441c9f9050928576477baeedf Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@enterprisedb.com>
Date: Sat, 24 Mar 2018 22:34:31 +1300
Subject: [PATCH 1/2] Correct some minor typos in the new JIT code.

Thomas Munro
---
 src/backend/jit/llvm/llvmjit.c         | 12 ++++++------
 src/backend/jit/llvm/llvmjit_error.cpp |  6 +++---
 src/backend/jit/llvm/llvmjit_expr.c    |  4 ++--
 src/backend/jit/llvm/llvmjit_types.c   |  2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c
index cd3c40c5f1b..54f6d3685ee 100644
--- a/src/backend/jit/llvm/llvmjit.c
+++ b/src/backend/jit/llvm/llvmjit.c
@@ -246,7 +246,7 @@ llvm_get_function(LLVMJitContext *context, const char *funcname)
 
 	/*
 	 * If there is a pending / not emitted module, compile and emit now.
-	 * Otherwise we migh not find the [correct] function.
+	 * Otherwise we might not find the [correct] function.
 	 */
 	if (!context->compiled)
 	{
@@ -265,7 +265,7 @@ llvm_get_function(LLVMJitContext *context, const char *funcname)
 
 		addr = 0;
 		if (LLVMOrcGetSymbolAddressIn(handle->stack, &addr, handle->orc_handle, funcname))
-			elog(ERROR, "failed to lookup symbol \"%s\"", funcname);
+			elog(ERROR, "failed to look up symbol \"%s\"", funcname);
 		if (addr)
 			return (void *) (uintptr_t) addr;
 	}
@@ -279,11 +279,11 @@ llvm_get_function(LLVMJitContext *context, const char *funcname)
 		return (void *) (uintptr_t) addr;
 #else
 	if (LLVMOrcGetSymbolAddress(llvm_opt0_orc, &addr, funcname))
-		elog(ERROR, "failed to lookup symbol \"%s\"", funcname);
+		elog(ERROR, "failed to look up symbol \"%s\"", funcname);
 	if (addr)
 		return (void *) (uintptr_t) addr;
 	if (LLVMOrcGetSymbolAddress(llvm_opt3_orc, &addr, funcname))
-		elog(ERROR, "failed to lookup symbol \"%s\"", funcname);
+		elog(ERROR, "failed to look up symbol \"%s\"", funcname);
 	if (addr)
 		return (void *) (uintptr_t) addr;
 #endif							/* LLVM_VERSION_MAJOR */
@@ -539,7 +539,7 @@ llvm_compile_module(LLVMJitContext *context)
 		if (LLVMOrcAddEagerlyCompiledIR(compile_orc, &orc_handle, smod,
 										llvm_resolve_symbol, NULL))
 		{
-			elog(ERROR, "failed to jit module");
+			elog(ERROR, "failed to JIT module");
 		}
 		LLVMOrcDisposeSharedModuleRef(smod);
 	}
@@ -845,7 +845,7 @@ llvm_resolve_symbol(const char *symname, void *ctx)
 	char	   *modname;
 
 	/*
-	 * OSX prefixes all object level symbols with an underscore. But neither
+	 * macOS prefixes all object level symbols with an underscore. But neither
 	 * dlsym() nor PG's inliner expect that. So undo.
 	 */
 #if defined(__darwin__)
diff --git a/src/backend/jit/llvm/llvmjit_error.cpp b/src/backend/jit/llvm/llvmjit_error.cpp
index edc1c479d01..a2bdfe3fb87 100644
--- a/src/backend/jit/llvm/llvmjit_error.cpp
+++ b/src/backend/jit/llvm/llvmjit_error.cpp
@@ -4,7 +4,7 @@
  *	  LLVM error related handling that requires interfacing with C++
  *
  * Unfortunately neither (re)setting the C++ new handler, nor the LLVM OOM
- * handler are exposed to C. Therefore this file wraps the necesary code.
+ * handler are exposed to C. Therefore this file wraps the necessary code.
  *
  * Copyright (c) 2016-2018, PostgreSQL Global Development Group
  *
@@ -39,12 +39,12 @@ static void fatal_llvm_error_handler(void *user_data, const std::string& reason,
  *
  * This is necessary for LLVM as LLVM's error handling for such cases
  * (exit()ing, throwing std::bad_alloc() if compiled with exceptions, abort())
- * isn't compatible with postgres error handling.  Thus in section where LLVM
+ * isn't compatible with postgres error handling.  Thus in sections where LLVM
  * code, not LLVM generated functions!, is executing, standard new, LLVM OOM
  * and LLVM fatal errors (some OOM errors masquerade as those) are redirected
  * to our own error handlers.
  *
- * These error handlers FATAL, because there's no reliable way from within
+ * These error handlers use FATAL, because there's no reliable way from within
  * LLVM to throw an error that's guaranteed not to corrupt LLVM's state.
  *
  * To avoid disturbing extensions using C++ and/or LLVM, these handlers are
diff --git a/src/backend/jit/llvm/llvmjit_expr.c b/src/backend/jit/llvm/llvmjit_expr.c
index 667fb01d3be..927f1bde426 100644
--- a/src/backend/jit/llvm/llvmjit_expr.c
+++ b/src/backend/jit/llvm/llvmjit_expr.c
@@ -1941,7 +1941,7 @@ llvm_compile_expr(ExprState *state)
 								isnull;
 
 					/*
-					 * At this point aggref->aggno is not yet set (it's setup
+					 * At this point aggref->aggno is not yet set (it's set up
 					 * in ExecInitAgg() after initializing the expression). So
 					 * load it from memory each time round.
 					 */
@@ -1977,7 +1977,7 @@ llvm_compile_expr(ExprState *state)
 
 					/*
 					 * At this point aggref->wfuncno is not yet set (it's
-					 * setup in ExecInitWindowAgg() after initializing the
+					 * set up in ExecInitWindowAgg() after initializing the
 					 * expression). So load it from memory each time round.
 					 */
 					v_wfuncnop = l_ptr_const(&wfunc->wfuncno,
diff --git a/src/backend/jit/llvm/llvmjit_types.c b/src/backend/jit/llvm/llvmjit_types.c
index 84bc1407373..ac7b41ea08c 100644
--- a/src/backend/jit/llvm/llvmjit_types.c
+++ b/src/backend/jit/llvm/llvmjit_types.c
@@ -8,7 +8,7 @@
  * low chance of definitions getting out of sync, this file lists types and
  * functions that directly need to be accessed from LLVM.
  *
- * When LlVM is first used in a backend, a bitcode version of this file, will
+ * When LLVM is first used in a backend, a bitcode version of this file will
  * be loaded. The needed types and signatures will be stored into Struct*,
  * Type*, Func* variables.
  *
-- 
2.16.2

