Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2e4db24

Browse files
committed
Remove configure --disable-float4-byval
This build option was only useful to maintain compatibility for version-0 functions, but those are no longer supported, so this option can be removed. float4 is now always pass-by-value; the pass-by-reference code path is completely removed. Discussion: https://www.postgresql.org/message-id/flat/f3e1e576-2749-bbd7-2d57-3f9dcf75255a@2ndquadrant.com
1 parent 43a54a3 commit 2e4db24

File tree

24 files changed

+18
-190
lines changed

24 files changed

+18
-190
lines changed

configure

-42
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,6 @@ with_system_tzdata
866866
with_zlib
867867
with_gnu_ld
868868
enable_largefile
869-
enable_float4_byval
870869
enable_float8_byval
871870
'
872871
ac_precious_vars='build_alias
@@ -1525,7 +1524,6 @@ Optional Features:
15251524
--enable-cassert enable assertion checks (for debugging)
15261525
--disable-thread-safety disable thread-safety in client libraries
15271526
--disable-largefile omit support for large files
1528-
--disable-float4-byval disable float4 passed by value
15291527
--disable-float8-byval disable float8 passed by value
15301528

15311529
Optional Packages:
@@ -16747,46 +16745,6 @@ _ACEOF
1674716745

1674816746

1674916747

16750-
# Decide whether float4 is passed by value: user-selectable, enabled by default
16751-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with float4 passed by value" >&5
16752-
$as_echo_n "checking whether to build with float4 passed by value... " >&6; }
16753-
16754-
16755-
# Check whether --enable-float4-byval was given.
16756-
if test "${enable_float4_byval+set}" = set; then :
16757-
enableval=$enable_float4_byval;
16758-
case $enableval in
16759-
yes)
16760-
16761-
$as_echo "#define USE_FLOAT4_BYVAL 1" >>confdefs.h
16762-
16763-
float4passbyval=true
16764-
;;
16765-
no)
16766-
float4passbyval=false
16767-
;;
16768-
*)
16769-
as_fn_error $? "no argument expected for --enable-float4-byval option" "$LINENO" 5
16770-
;;
16771-
esac
16772-
16773-
else
16774-
enable_float4_byval=yes
16775-
16776-
$as_echo "#define USE_FLOAT4_BYVAL 1" >>confdefs.h
16777-
16778-
float4passbyval=true
16779-
fi
16780-
16781-
16782-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_float4_byval" >&5
16783-
$as_echo "$enable_float4_byval" >&6; }
16784-
16785-
cat >>confdefs.h <<_ACEOF
16786-
#define FLOAT4PASSBYVAL $float4passbyval
16787-
_ACEOF
16788-
16789-
1679016748
# Decide whether float8 is passed by value.
1679116749
# Note: this setting also controls int8 and related types such as timestamp.
1679216750
# If sizeof(Datum) >= 8, this is user-selectable, enabled by default.

configure.in

-10
Original file line numberDiff line numberDiff line change
@@ -1941,16 +1941,6 @@ AC_CHECK_SIZEOF([void *])
19411941
AC_CHECK_SIZEOF([size_t])
19421942
AC_CHECK_SIZEOF([long])
19431943

1944-
# Decide whether float4 is passed by value: user-selectable, enabled by default
1945-
AC_MSG_CHECKING([whether to build with float4 passed by value])
1946-
PGAC_ARG_BOOL(enable, float4-byval, yes, [disable float4 passed by value],
1947-
[AC_DEFINE([USE_FLOAT4_BYVAL], 1,
1948-
[Define to 1 if you want float4 values to be passed by value. (--enable-float4-byval)])
1949-
float4passbyval=true],
1950-
[float4passbyval=false])
1951-
AC_MSG_RESULT([$enable_float4_byval])
1952-
AC_DEFINE_UNQUOTED([FLOAT4PASSBYVAL], [$float4passbyval], [float4 values are passed by value if 'true', by reference if 'false'])
1953-
19541944
# Decide whether float8 is passed by value.
19551945
# Note: this setting also controls int8 and related types such as timestamp.
19561946
# If sizeof(Datum) >= 8, this is user-selectable, enabled by default.

doc/src/sgml/func.sgml

-5
Original file line numberDiff line numberDiff line change
@@ -19964,11 +19964,6 @@ SELECT collation for ('foo' COLLATE "de_DE");
1996419964
<entry><type>integer</type></entry>
1996519965
</row>
1996619966

19967-
<row>
19968-
<entry><literal>float4_pass_by_value</literal></entry>
19969-
<entry><type>boolean</type></entry>
19970-
</row>
19971-
1997219967
<row>
1997319968
<entry><literal>float8_pass_by_value</literal></entry>
1997419969
<entry><type>boolean</type></entry>

doc/src/sgml/installation.sgml

-12
Original file line numberDiff line numberDiff line change
@@ -1204,18 +1204,6 @@ build-postgresql:
12041204
</listitem>
12051205
</varlistentry>
12061206

1207-
<varlistentry>
1208-
<term><option>--disable-float4-byval</option></term>
1209-
<listitem>
1210-
<para>
1211-
Disable passing float4 values <quote>by value</quote>, causing them
1212-
to be passed <quote>by reference</quote> instead. This option costs
1213-
performance, but may be needed for compatibility with very old
1214-
user-defined functions written in C.
1215-
</para>
1216-
</listitem>
1217-
</varlistentry>
1218-
12191207
<varlistentry>
12201208
<term><option>--disable-float8-byval</option></term>
12211209
<listitem>

src/backend/access/index/indexam.c

-5
Original file line numberDiff line numberDiff line change
@@ -879,11 +879,6 @@ index_store_float8_orderby_distances(IndexScanDesc scan, Oid *orderByTypes,
879879
else if (orderByTypes[i] == FLOAT4OID)
880880
{
881881
/* convert distance function's result to ORDER BY type */
882-
#ifndef USE_FLOAT4_BYVAL
883-
/* must free any old value to avoid memory leakage */
884-
if (!scan->xs_orderbynulls[i])
885-
pfree(DatumGetPointer(scan->xs_orderbyvals[i]));
886-
#endif
887882
if (distances && !distances[i].isnull)
888883
{
889884
scan->xs_orderbyvals[i] = Float4GetDatum((float4) distances[i].value);

src/backend/access/transam/xlog.c

-17
Original file line numberDiff line numberDiff line change
@@ -4516,7 +4516,6 @@ WriteControlFile(void)
45164516
ControlFile->toast_max_chunk_size = TOAST_MAX_CHUNK_SIZE;
45174517
ControlFile->loblksize = LOBLKSIZE;
45184518

4519-
ControlFile->float4ByVal = FLOAT4PASSBYVAL;
45204519
ControlFile->float8ByVal = FLOAT8PASSBYVAL;
45214520

45224521
/* Contents are protected with a CRC */
@@ -4720,22 +4719,6 @@ ReadControlFile(void)
47204719
ControlFile->loblksize, (int) LOBLKSIZE),
47214720
errhint("It looks like you need to recompile or initdb.")));
47224721

4723-
#ifdef USE_FLOAT4_BYVAL
4724-
if (ControlFile->float4ByVal != true)
4725-
ereport(FATAL,
4726-
(errmsg("database files are incompatible with server"),
4727-
errdetail("The database cluster was initialized without USE_FLOAT4_BYVAL"
4728-
" but the server was compiled with USE_FLOAT4_BYVAL."),
4729-
errhint("It looks like you need to recompile or initdb.")));
4730-
#else
4731-
if (ControlFile->float4ByVal != false)
4732-
ereport(FATAL,
4733-
(errmsg("database files are incompatible with server"),
4734-
errdetail("The database cluster was initialized with USE_FLOAT4_BYVAL"
4735-
" but the server was compiled without USE_FLOAT4_BYVAL."),
4736-
errhint("It looks like you need to recompile or initdb.")));
4737-
#endif
4738-
47394722
#ifdef USE_FLOAT8_BYVAL
47404723
if (ControlFile->float8ByVal != true)
47414724
ereport(FATAL,

src/backend/bootstrap/bootstrap.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static const struct typinfo TypInfo[] = {
111111
F_INT2IN, F_INT2OUT},
112112
{"int4", INT4OID, 0, 4, true, 'i', 'p', InvalidOid,
113113
F_INT4IN, F_INT4OUT},
114-
{"float4", FLOAT4OID, 0, 4, FLOAT4PASSBYVAL, 'i', 'p', InvalidOid,
114+
{"float4", FLOAT4OID, 0, 4, true, 'i', 'p', InvalidOid,
115115
F_FLOAT4IN, F_FLOAT4OUT},
116116
{"name", NAMEOID, CHAROID, NAMEDATALEN, false, 'c', 'p', C_COLLATION_OID,
117117
F_NAMEIN, F_NAMEOUT},

src/backend/catalog/genbki.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ sub morph_row_for_schemapg
890890
}
891891

892892
# Expand booleans from 'f'/'t' to 'false'/'true'.
893-
# Some values might be other macros (eg FLOAT4PASSBYVAL),
893+
# Some values might be other macros (eg FLOAT8PASSBYVAL),
894894
# don't change.
895895
elsif ($atttype eq 'bool')
896896
{

src/backend/commands/analyze.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,7 @@ update_attstats(Oid relid, bool inh, int natts, VacAttrStats **vacattrstats)
14961496
/* XXX knows more than it should about type float4: */
14971497
arry = construct_array(numdatums, nnum,
14981498
FLOAT4OID,
1499-
sizeof(float4), FLOAT4PASSBYVAL, 'i');
1499+
sizeof(float4), true, 'i');
15001500
values[i++] = PointerGetDatum(arry); /* stanumbersN */
15011501
}
15021502
else

src/backend/utils/fmgr/dfmgr.c

-9
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,6 @@ incompatible_module_error(const char *libname,
365365
magic_data.namedatalen,
366366
module_magic_data->namedatalen);
367367
}
368-
if (module_magic_data->float4byval != magic_data.float4byval)
369-
{
370-
if (details.len)
371-
appendStringInfoChar(&details, '\n');
372-
appendStringInfo(&details,
373-
_("Server has FLOAT4PASSBYVAL = %s, library has %s."),
374-
magic_data.float4byval ? "true" : "false",
375-
module_magic_data->float4byval ? "true" : "false");
376-
}
377368
if (module_magic_data->float8byval != magic_data.float8byval)
378369
{
379370
if (details.len)

src/backend/utils/fmgr/fmgr.c

+2-17
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ OidSendFunctionCall(Oid functionId, Datum val)
16831683
/*-------------------------------------------------------------------------
16841684
* Support routines for standard maybe-pass-by-reference datatypes
16851685
*
1686-
* int8, float4, and float8 can be passed by value if Datum is wide enough.
1686+
* int8 and float8 can be passed by value if Datum is wide enough.
16871687
* (For backwards-compatibility reasons, we allow pass-by-ref to be chosen
16881688
* at compile time even if pass-by-val is possible.)
16891689
*
@@ -1703,21 +1703,6 @@ Int64GetDatum(int64 X)
17031703
*retval = X;
17041704
return PointerGetDatum(retval);
17051705
}
1706-
#endif /* USE_FLOAT8_BYVAL */
1707-
1708-
#ifndef USE_FLOAT4_BYVAL
1709-
1710-
Datum
1711-
Float4GetDatum(float4 X)
1712-
{
1713-
float4 *retval = (float4 *) palloc(sizeof(float4));
1714-
1715-
*retval = X;
1716-
return PointerGetDatum(retval);
1717-
}
1718-
#endif
1719-
1720-
#ifndef USE_FLOAT8_BYVAL
17211706

17221707
Datum
17231708
Float8GetDatum(float8 X)
@@ -1727,7 +1712,7 @@ Float8GetDatum(float8 X)
17271712
*retval = X;
17281713
return PointerGetDatum(retval);
17291714
}
1730-
#endif
1715+
#endif /* USE_FLOAT8_BYVAL */
17311716

17321717

17331718
/*-------------------------------------------------------------------------

src/backend/utils/misc/pg_controldata.c

+6-11
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ pg_control_recovery(PG_FUNCTION_ARGS)
264264
Datum
265265
pg_control_init(PG_FUNCTION_ARGS)
266266
{
267-
Datum values[12];
268-
bool nulls[12];
267+
Datum values[11];
268+
bool nulls[11];
269269
TupleDesc tupdesc;
270270
HeapTuple htup;
271271
ControlFileData *ControlFile;
@@ -294,11 +294,9 @@ pg_control_init(PG_FUNCTION_ARGS)
294294
INT4OID, -1, 0);
295295
TupleDescInitEntry(tupdesc, (AttrNumber) 9, "large_object_chunk_size",
296296
INT4OID, -1, 0);
297-
TupleDescInitEntry(tupdesc, (AttrNumber) 10, "float4_pass_by_value",
297+
TupleDescInitEntry(tupdesc, (AttrNumber) 10, "float8_pass_by_value",
298298
BOOLOID, -1, 0);
299-
TupleDescInitEntry(tupdesc, (AttrNumber) 11, "float8_pass_by_value",
300-
BOOLOID, -1, 0);
301-
TupleDescInitEntry(tupdesc, (AttrNumber) 12, "data_page_checksum_version",
299+
TupleDescInitEntry(tupdesc, (AttrNumber) 11, "data_page_checksum_version",
302300
INT4OID, -1, 0);
303301
tupdesc = BlessTupleDesc(tupdesc);
304302

@@ -335,15 +333,12 @@ pg_control_init(PG_FUNCTION_ARGS)
335333
values[8] = Int32GetDatum(ControlFile->loblksize);
336334
nulls[8] = false;
337335

338-
values[9] = BoolGetDatum(ControlFile->float4ByVal);
336+
values[9] = BoolGetDatum(ControlFile->float8ByVal);
339337
nulls[9] = false;
340338

341-
values[10] = BoolGetDatum(ControlFile->float8ByVal);
339+
values[10] = Int32GetDatum(ControlFile->data_checksum_version);
342340
nulls[10] = false;
343341

344-
values[11] = Int32GetDatum(ControlFile->data_checksum_version);
345-
nulls[11] = false;
346-
347342
htup = heap_form_tuple(tupdesc, values, nulls);
348343

349344
PG_RETURN_DATUM(HeapTupleGetDatum(htup));

src/bin/initdb/initdb.c

-3
Original file line numberDiff line numberDiff line change
@@ -1399,9 +1399,6 @@ bootstrap_template1(void)
13991399
bki_lines = replace_token(bki_lines, "ALIGNOF_POINTER",
14001400
(sizeof(Pointer) == 4) ? "i" : "d");
14011401

1402-
bki_lines = replace_token(bki_lines, "FLOAT4PASSBYVAL",
1403-
FLOAT4PASSBYVAL ? "true" : "false");
1404-
14051402
bki_lines = replace_token(bki_lines, "FLOAT8PASSBYVAL",
14061403
FLOAT8PASSBYVAL ? "true" : "false");
14071404

src/bin/pg_controldata/pg_controldata.c

-2
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,6 @@ main(int argc, char *argv[])
327327
/* This is no longer configurable, but users may still expect to see it: */
328328
printf(_("Date/time type storage: %s\n"),
329329
_("64-bit integers"));
330-
printf(_("Float4 argument passing: %s\n"),
331-
(ControlFile->float4ByVal ? _("by value") : _("by reference")));
332330
printf(_("Float8 argument passing: %s\n"),
333331
(ControlFile->float8ByVal ? _("by value") : _("by reference")));
334332
printf(_("Data page checksum version: %u\n"),

src/bin/pg_resetwal/pg_resetwal.c

-3
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,6 @@ GuessControlValues(void)
722722
ControlFile.indexMaxKeys = INDEX_MAX_KEYS;
723723
ControlFile.toast_max_chunk_size = TOAST_MAX_CHUNK_SIZE;
724724
ControlFile.loblksize = LOBLKSIZE;
725-
ControlFile.float4ByVal = FLOAT4PASSBYVAL;
726725
ControlFile.float8ByVal = FLOAT8PASSBYVAL;
727726

728727
/*
@@ -801,8 +800,6 @@ PrintControlValues(bool guessed)
801800
/* This is no longer configurable, but users may still expect to see it: */
802801
printf(_("Date/time type storage: %s\n"),
803802
_("64-bit integers"));
804-
printf(_("Float4 argument passing: %s\n"),
805-
(ControlFile.float4ByVal ? _("by value") : _("by reference")));
806803
printf(_("Float8 argument passing: %s\n"),
807804
(ControlFile.float8ByVal ? _("by value") : _("by reference")));
808805
printf(_("Data page checksum version: %u\n"),

src/include/catalog/catversion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 201911211
56+
#define CATALOG_VERSION_NO 201911212
5757

5858
#endif

src/include/catalog/pg_control.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

2424
/* Version identifier for this pg_control format */
25-
#define PG_CONTROL_VERSION 1201
25+
#define PG_CONTROL_VERSION 1300
2626

2727
/* Nonce key length, see below */
2828
#define MOCK_AUTH_NONCE_LEN 32
@@ -214,8 +214,6 @@ typedef struct ControlFileData
214214
uint32 toast_max_chunk_size; /* chunk size in TOAST tables */
215215
uint32 loblksize; /* chunk size in pg_largeobject */
216216

217-
/* flags indicating pass-by-value status of various types */
218-
bool float4ByVal; /* float4 pass-by-value? */
219217
bool float8ByVal; /* float8, int8, etc pass-by-value? */
220218

221219
/* Are data pages protected by checksums? Zero if no checksum version */

src/include/catalog/pg_proc.dat

+3-3
Original file line numberDiff line numberDiff line change
@@ -10660,9 +10660,9 @@
1066010660
descr => 'pg_controldata init state information as a function',
1066110661
proname => 'pg_control_init', provolatile => 'v', prorettype => 'record',
1066210662
proargtypes => '',
10663-
proallargtypes => '{int4,int4,int4,int4,int4,int4,int4,int4,int4,bool,bool,int4}',
10664-
proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o}',
10665-
proargnames => '{max_data_alignment,database_block_size,blocks_per_segment,wal_block_size,bytes_per_wal_segment,max_identifier_length,max_index_columns,max_toast_chunk_size,large_object_chunk_size,float4_pass_by_value,float8_pass_by_value,data_page_checksum_version}',
10663+
proallargtypes => '{int4,int4,int4,int4,int4,int4,int4,int4,int4,bool,int4}',
10664+
proargmodes => '{o,o,o,o,o,o,o,o,o,o,o}',
10665+
proargnames => '{max_data_alignment,database_block_size,blocks_per_segment,wal_block_size,bytes_per_wal_segment,max_identifier_length,max_index_columns,max_toast_chunk_size,large_object_chunk_size,float8_pass_by_value,data_page_checksum_version}',
1066610666
prosrc => 'pg_control_init' },
1066710667

1066810668
# collation management functions

src/include/catalog/pg_type.dat

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215

216216
{ oid => '700', array_type_oid => '1021',
217217
descr => 'single-precision floating point number, 4-byte storage',
218-
typname => 'float4', typlen => '4', typbyval => 'FLOAT4PASSBYVAL',
218+
typname => 'float4', typlen => '4', typbyval => 't',
219219
typcategory => 'N', typinput => 'float4in', typoutput => 'float4out',
220220
typreceive => 'float4recv', typsend => 'float4send', typalign => 'i' },
221221
{ oid => '701', array_type_oid => '1022',

src/include/fmgr.h

-2
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ typedef struct
446446
int funcmaxargs; /* FUNC_MAX_ARGS */
447447
int indexmaxkeys; /* INDEX_MAX_KEYS */
448448
int namedatalen; /* NAMEDATALEN */
449-
int float4byval; /* FLOAT4PASSBYVAL */
450449
int float8byval; /* FLOAT8PASSBYVAL */
451450
} Pg_magic_struct;
452451

@@ -458,7 +457,6 @@ typedef struct
458457
FUNC_MAX_ARGS, \
459458
INDEX_MAX_KEYS, \
460459
NAMEDATALEN, \
461-
FLOAT4PASSBYVAL, \
462460
FLOAT8PASSBYVAL \
463461
}
464462

0 commit comments

Comments
 (0)