From ef302baca81ceaedbfb128fae60a42e53910f061 Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Wed, 24 Oct 2012 11:30:42 +0200 Subject: Remove R9 compatibility features --- erts/emulator/beam/erl_init.c | 36 ++++++++------------------- erts/emulator/beam/erl_node_container_utils.h | 18 -------------- erts/emulator/beam/erl_process.c | 4 +-- erts/emulator/beam/erl_ptab.c | 8 ++---- erts/emulator/beam/erl_term.h | 8 ------ erts/emulator/beam/io.c | 7 ------ 6 files changed, 14 insertions(+), 67 deletions(-) (limited to 'erts/emulator') diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c index d4004361af..9ef66456ac 100644 --- a/erts/emulator/beam/erl_init.c +++ b/erts/emulator/beam/erl_init.c @@ -125,8 +125,6 @@ extern void ConWaitForExit(void); static void erl_init(int ncpu, int proc_tab_sz); -#define ERTS_MIN_COMPAT_REL 7 - static erts_atomic_t exiting; #ifdef ERTS_SMP @@ -208,8 +206,6 @@ ErtsModifiedTimings erts_modified_timings[] = { Export *erts_delay_trap = NULL; -int erts_use_r9_pids_ports; - #ifdef HYBRID Eterm *global_heap; Eterm *global_hend; @@ -520,6 +516,7 @@ load_preloaded(void) /* be helpful (or maybe downright rude:-) */ void erts_usage(void) { + int this_rel = this_rel_num(); erts_fprintf(stderr, "Usage: %s [flags] [ -- [init_args] ]\n", progname(program)); erts_fprintf(stderr, "The flags are:\n\n"); @@ -562,7 +559,7 @@ void erts_usage(void) ERTS_MIN_PROCESSES, ERTS_MAX_PROCESSES); erts_fprintf(stderr, "-R number set compatibility release number,\n"); erts_fprintf(stderr, " valid range [%d-%d]\n", - ERTS_MIN_COMPAT_REL, this_rel_num()); + this_rel-2, this_rel); erts_fprintf(stderr, "-r force ets memory block to be moved on realloc\n"); erts_fprintf(stderr, "-rg amount set reader groups limit\n"); @@ -699,8 +696,6 @@ early_init(int *argc, char **argv) /* erts_compat_rel = this_rel_num(); - erts_use_r9_pids_ports = 0; - erts_sys_pre_init(); erts_atomic_init_nob(&exiting, 0); #ifdef ERTS_SMP @@ -1219,8 +1214,11 @@ erl_start(int argc, char **argv) /* set maximum number of processes */ Parg = get_arg(argv[i]+2, argv[i+1], &i); proc_tab_sz = atoi(Parg); - /* Check of result is delayed until later. This is because +R - may be given after +P. */ + if (proc_tab_sz < ERTS_MIN_PROCESSES + || proc_tab_sz > ERTS_MAX_PROCESSES) { + erts_fprintf(stderr, "bad number of processes %s\n", Parg); + erts_usage(); + } break; case 'S' : /* Was handled in early_init() just read past it */ @@ -1383,22 +1381,19 @@ erl_start(int argc, char **argv) case 'R': { /* set compatibility release */ + int this_rel; arg = get_arg(argv[i]+2, argv[i+1], &i); erts_compat_rel = atoi(arg); - if (erts_compat_rel < ERTS_MIN_COMPAT_REL - || erts_compat_rel > this_rel_num()) { + this_rel = this_rel_num(); + if (erts_compat_rel < this_rel - 2 || this_rel < erts_compat_rel) { erts_fprintf(stderr, "bad compatibility release number %s\n", arg); erts_usage(); } - ASSERT(ERTS_MIN_COMPAT_REL >= 7); switch (erts_compat_rel) { - case 7: - case 8: - case 9: - erts_use_r9_pids_ports = 1; + /* Currently no compat features... */ default: break; } @@ -1496,15 +1491,6 @@ erl_start(int argc, char **argv) i++; } - /* Delayed check of +P flag */ - if (proc_tab_sz < ERTS_MIN_PROCESSES - || proc_tab_sz > ERTS_MAX_PROCESSES - || (erts_use_r9_pids_ports - && proc_tab_sz > ERTS_MAX_R9_PROCESSES)) { - erts_fprintf(stderr, "bad number of processes %s\n", Parg); - erts_usage(); - } - /* Restart will not reinstall the break handler */ #ifdef __WIN32__ if (ignore_break) diff --git a/erts/emulator/beam/erl_node_container_utils.h b/erts/emulator/beam/erl_node_container_utils.h index 7796cbfc2b..56f658993b 100644 --- a/erts/emulator/beam/erl_node_container_utils.h +++ b/erts/emulator/beam/erl_node_container_utils.h @@ -29,9 +29,6 @@ * the emulator) for the Erlang data types that contain a reference * to a node, i.e. pids, ports, and references. * - * Observe! The layouts of the node container data types have been - * changed in R9. - * * Node containers are divided into internal and external node containers. * An internal node container refer to the current incarnation of the * node which it reside on. An external node container refer to @@ -52,13 +49,6 @@ * reference is a boxed data type. An internal node container have an * implicit reference to the 'erts_this_node' element in the node table. * - * Due to the R9 changes in layouts of node containers there are room to - * store more data than previously. Today (R9) this extra space is unused, - * but it is planned to be used in the future. For example only 18 bits - * are used for data in a pid but there is room for 28 bits of data (on a - * 32-bit machine). Some preparations have been made in the emulator for - * usage of this extra space. - * * OBSERVE! Pids doesn't use fixed size 'serial' and 'number' fields any * more. Previously the 15 bit 'number' field of a pid was used as index * into the process table, and the 3 bit 'serial' field was used as a @@ -104,8 +94,6 @@ #define internal_dist_entry(x) (erts_this_node->dist_entry) #define external_dist_entry(x) (external_node((x))->dist_entry) -extern int erts_use_r9_pids_ports; - /* * For this node (and previous incarnations of this node), 0 is used as * channel no. For other nodes, the atom index of the atom corresponding @@ -171,8 +159,6 @@ extern ErtsPTab erts_proc; || is_external_pid((x))) #define is_not_pid(x) (!is_pid(x)) -#define ERTS_MAX_R9_PROCESSES (1 << ERTS_R9_PROC_BITS) - /* * Maximum number of processes. We want the number to fit in a SMALL on * 32-bit CPU. @@ -186,9 +172,7 @@ extern ErtsPTab erts_proc; #define ERTS_MAX_PID_DATA ((1 << _PID_DATA_SIZE) - 1) #define ERTS_MAX_PID_NUMBER ((1 << _PID_NUM_SIZE) - 1) #define ERTS_MAX_PID_SERIAL ((1 << _PID_SER_SIZE) - 1) -#define ERTS_MAX_PID_R9_SERIAL ((1 << _PID_R9_SER_SIZE) - 1) -#define ERTS_R9_PROC_BITS (_PID_R9_SER_SIZE + _PID_NUM_SIZE) #define ERTS_PROC_BITS (_PID_SER_SIZE + _PID_NUM_SIZE) #define ERTS_INVALID_PID make_internal_pid(ERTS_MAX_PID_DATA) @@ -243,13 +227,11 @@ extern ErtsPTab erts_port; which defines the maximum number of simultaneous Ports in the Erlang node. ERTS_MAX_PORTS is a hard upper limit. */ -#define ERTS_MAX_R9_PORTS (1 << ERTS_R9_PORTS_BITS) #define ERTS_MAX_PORTS (1 << ERTS_PORTS_BITS) #define ERTS_MAX_PORT_DATA ((1 << _PORT_DATA_SIZE) - 1) #define ERTS_MAX_PORT_NUMBER ((1 << _PORT_NUM_SIZE) - 1) -#define ERTS_R9_PORTS_BITS (_PORT_R9_NUM_SIZE) #define ERTS_PORTS_BITS (_PORT_NUM_SIZE) #define ERTS_INVALID_PORT make_internal_port(ERTS_MAX_PORT_DATA) diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index e6fe4ccdc1..07b1ecdbb4 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -6937,9 +6937,7 @@ alloc_process(ErtsRunQueue *rq, erts_aint32_t state) return NULL; } - ASSERT(internal_pid_serial(p->common.id) <= (erts_use_r9_pids_ports - ? ERTS_MAX_PID_R9_SERIAL - : ERTS_MAX_PID_SERIAL)); + ASSERT(internal_pid_serial(p->common.id) <= ERTS_MAX_PID_SERIAL); p->approx_started = erts_get_approx_time(); p->rcount = 0; diff --git a/erts/emulator/beam/erl_ptab.c b/erts/emulator/beam/erl_ptab.c index 8cab1de9da..eba0c286cc 100644 --- a/erts/emulator/beam/erl_ptab.c +++ b/erts/emulator/beam/erl_ptab.c @@ -432,7 +432,6 @@ erts_ptab_init_table(ErtsPTab *ptab, int max_data_bits; char *tab_end; erts_smp_atomic_t *tab_entry; - int proc_bits = ERTS_PROC_BITS; erts_smp_rwmtx_opt_t rwmtx_opts = ERTS_SMP_RWMTX_OPT_DEFAULT_INITER; rwmtx_opts.type = ERTS_SMP_RWMTX_TYPE_EXTREMELY_FREQUENT_READ; rwmtx_opts.lived = ERTS_SMP_RWMTX_LONG_LIVED; @@ -441,11 +440,8 @@ erts_ptab_init_table(ErtsPTab *ptab, erts_smp_atomic32_init_nob(&ptab->vola.tile.count, 0); last_data_init_nob(ptab, ~((Uint64) 0)); - if (erts_use_r9_pids_ports) - proc_bits = ERTS_R9_PROC_BITS; - - if (size > (1 << proc_bits)) - size = 1 << proc_bits; + if (size > (1 << ERTS_PROC_BITS)) + size = 1 << ERTS_PROC_BITS; ptab->r.o.max = size; diff --git a/erts/emulator/beam/erl_term.h b/erts/emulator/beam/erl_term.h index c270d13365..7349d3e0c7 100644 --- a/erts/emulator/beam/erl_term.h +++ b/erts/emulator/beam/erl_term.h @@ -541,12 +541,6 @@ _ET_DECLARE_CHECKED(Eterm*,tuple_val,Wterm) #define _GETBITS(X,Pos,Size) (((X) >> (Pos)) & ~(~((Uint) 0) << (Size))) -/* - * Observe! New layout for pids, ports and references in R9 (see also note - * in erl_node_container_utils.h). - */ - - /* * Creation in node specific data (pids, ports, refs) */ @@ -584,7 +578,6 @@ _ET_DECLARE_CHECKED(Eterm*,tuple_val,Wterm) * */ -#define _PID_R9_SER_SIZE 3 #define _PID_SER_SIZE (_PID_DATA_SIZE - _PID_NUM_SIZE) #define _PID_NUM_SIZE 15 @@ -644,7 +637,6 @@ _ET_DECLARE_CHECKED(struct erl_node_*,internal_pid_node,Eterm) * N : node number * */ -#define _PORT_R9_NUM_SIZE 18 #define _PORT_NUM_SIZE _PORT_DATA_SIZE #define _PORT_DATA_SIZE 28 diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c index 4dcec356a9..21fc76b8db 100644 --- a/erts/emulator/beam/io.c +++ b/erts/emulator/beam/io.c @@ -1244,7 +1244,6 @@ void init_io(void) ErlDrvEntry** dp; char maxports[21]; /* enough for any 64-bit integer */ size_t maxportssize = sizeof(maxports); - Uint ports_bits = ERTS_PORTS_BITS; int port_tab_size; #ifdef ERTS_SMP @@ -1263,12 +1262,6 @@ void init_io(void) if (port_tab_size < 1024) port_tab_size = 1024; - if (erts_use_r9_pids_ports) { - ports_bits = ERTS_R9_PORTS_BITS; - if (port_tab_size > ERTS_MAX_R9_PORTS) - port_tab_size = ERTS_MAX_R9_PORTS; - } - erts_smp_mtx_init(&erts_driver_list_lock,"driver_list"); driver_list = NULL; erts_smp_tsd_key_create(&driver_list_lock_status_key); -- cgit v1.2.3