M Messié

A Petrenko

A Doglioli

E Martinez

S Alvain

Basin-scale biogeochemical and ecological impacts of islands in the tropical Pacific Ocean

In the relatively unproductive waters of the tropical ocean, islands can enhance phytoplankton biomass and create hotspots of productivity and biodiversity that sustain upper trophic levels, including fish that are crucial to the survival of islands' inhabitants. This phenomenon, coined the "island mass effect" sixty-five years ago, has been widely described. However, most studies focused on individual islands, and very few documented phytoplankton community composition. Consequently, basin-scale impacts on phytoplankton biomass, primary production, and biodiversity remain largely unknown.

Here we systematically identify enriched waters near islands from satellite chlorophyll concentration (a proxy for phytoplankton biomass) to analyze the island mass effect for all tropical Pacific islands on a climatological basis. We find enrichments near 99% of islands, impacting 3% of the tropical Pacific Ocean. We quantify local and basin-scale increases in chlorophyll and primary production by contrasting island-enriched waters with nearby waters. We also unveil, for the first time, a significant impact on phytoplankton community structure and biodiversity visible in anomalies in the ocean color signal. Our results suggest that, in addition to strong local biogeochemical impacts, islands may have even stronger and further reaching ecological impacts.

Phytoplankton, the tiny drifting algae that fix carbon dioxide via photosynthesis, are responsible for about half of the world's primary production 1 and support essentially all life in the open ocean. Their community composition and biodiversity have been tied to vertical carbon export, resource use efficiency, and ecological stability 2,3,4 . As such, phytoplankton biomass, production, and biodiversity have far-reaching impacts on marine ecosystems and the global carbon cycle. It is thus paramount to understand their environmental drivers so as to predict, and potentially mitigate, how they may change in the future. In most of the tropical ocean, nutrient supply is the

primary factor limiting phytoplankton growth [START_REF] Arteaga | Global patterns of phytoplankton nutrient and light colimitation inferred from an optimality-based model[END_REF] . Far from continents, nutrients are brought to the sunlit surface layer primarily by vertical mixing [START_REF] Lewis | Vertical nitrate fluxes in the oligotrophic ocean[END_REF] , wind-and eddy-driven upwelling [START_REF] Mcgillicuddy | Eddy/wind interactions stimulate extraordinary mid-ocean plankton blooms[END_REF] , atmospheric deposition [START_REF] Duce | Impacts of atmospheric anthropogenic nitrogen on the open ocean[END_REF] , nitrogen fixation [START_REF] Tang | Revisiting the distribution of oceanic N2 fixation and estimating diazotrophic contribution to marine production[END_REF] , and horizontal advection [START_REF] Letscher | Nutrient budgets in the subtropical ocean gyres dominated by lateral transport[END_REF] . Phytoplankton biodiversity is difficult to monitor; its patterns and drivers remain largely unknown even when focusing on the simplest of biodiversity metrics, richness (number of coexisting species). Several studies found high richness in warm, stable tropical regions and identified temperature as the primary phytoplankton richness driver [START_REF] Righetti | Global pattern of phytoplankton diversity driven by temperature and environmental variability[END_REF][START_REF] Ibarbalz | Global trends in marine plankton diversity across kingdoms of life[END_REF] . Others described increased richness in dynamic regions [START_REF] Lévy | The role of submesoscale currents in structuring marine ecosystems[END_REF] , highlighting drivers such as nutrient supply rate and composition, advection, and top-down control [START_REF] Dutkiewicz | Dimensions of marine phytoplankton diversity[END_REF] .

Here, we focus on a phenomenon that has paradoxically received little attention at the basin scale, despite its prevalence and strong local impacts: island-driven increases in phytoplankton production, resulting in nearly ubiquitous chlorophyll enrichments near tropical Pacific islands and atolls [START_REF] Gove | Near-island biological hotspots in barren ocean basins[END_REF] . This "island mass effect" (IME) [START_REF] Doty | The island mass effect[END_REF] can result from various processes such as upwelling and mixing in lee eddies, island runoff, submarine groundwater discharge, and others (reviewed by Gove et al. [START_REF] Gove | Near-island biological hotspots in barren ocean basins[END_REF] ). These processes supply additional nutrients relative to surrounding waters, supporting enhanced phytoplankton growth and dramatically increasing local productivity. The resulting increased fish production is crucial to Pacific island societies that rely on fishing for food security and protein intake [START_REF] Bell | Planning the use of fish for food security in the Pacific[END_REF] . By increasing primary production, islands can also locally create an important oceanic sink for atmospheric CO2 (as observed in the Southern Ocean [START_REF] Bakker | The island mass effect and biological carbon uptake for the subantarctic Crozet Archipelago, Deep Sea Research Part II[END_REF] ) and have been hypothesized to significantly contribute to the global carbon budget [START_REF] Heywood | Eddy formation behind the tropical island of Aldabra[END_REF] .

IMEs have been described for a few of the thousands of tropical Pacific islands, notably the Galapagos [START_REF] Palacios | Factors influencing the island-mass effect of the Galapagos archipelago[END_REF] , Hawaii [START_REF] Gilmartin | The 'island mass' effect on the phytoplankton and primary production of the Hawaiian Islands[END_REF] , the Marquesas 22 , Kiribati [START_REF] Messié | Chlorophyll bloom in the western Pacific at the end of the 1997-98 El Niño: the role of the Kiribati Islands[END_REF] , Solomon [START_REF] Messié | Seasonal variability of the surface chlorophyll in the western tropical Pacific from SeaWiFS data[END_REF] , New Caledonia 25 , Tonga [START_REF] Messié | The delayed island mass effect: How islands can remotely trigger blooms in the oligotrophic ocean[END_REF] , Vanuatu, and Fiji [START_REF] Dandonneau | An empirical approach to the island mass effect in the south tropical Pacific based on sea surface chlorophyll concentrations[END_REF] . There are also some rare reports of island impacts on phytoplankton community composition [START_REF] Shiozaki | Large-scale impact of the island mass effect through nitrogen fixation in the western South Pacific Ocean[END_REF][START_REF] Caputi | Community-level responses to iron availability in open ocean plankton ecosystems[END_REF][START_REF] Martinez | Plankton spatial variability within the Marquesas archipelago, South Pacific[END_REF] . Only two studies systematically investigated the IME for several islands at once: a compilation of in situ chlorophyll concentration in the south tropical Pacific [START_REF] Dandonneau | An empirical approach to the island mass effect in the south tropical Pacific based on sea surface chlorophyll concentrations[END_REF] , and an analysis of satellite chlorophyll increase near 35 coral reef islands and atolls [START_REF] Gove | Near-island biological hotspots in barren ocean basins[END_REF] . Neither study considered phytoplankton community composition. A systematic study of the IME for all islands in the tropical Pacific, particularly addressing impacts on phytoplankton biodiversity, is unprecedented.

Characterizing island mass effects in the tropical Pacific

We investigated the IME for all tropical Pacific islands and shallow reefs using satellite surface chlorophyll concentrations (hereafter Chl). A total of 11,449 islands and 4,602 shallow reefs were identified from high-resolution coastline and bathymetry. Islands and reefs were combined within land pixels of the 4 km resolution Chl grid (pixels shallower than 30 m were treated as land, see Methods), resulting in a database of 437 islands and 227 shallow reefs (hereafter "islands"). An algorithm automatically detecting IMEs from Chl maps was developed and applied both to the time-averaged Chl and to a monthly climatology. For each island, the algorithm identified the IME as a Chl contour enclosing the island and surrounding high-Chl waters, termed IME region. A reference (REF) region of the same size was detected alongside each IME region, enclosing nearby non-IME waters (Extended Fig. 1). The REF region represents conditions that would exist if no IME was present. Increases in Chl nearby islands and within the IME regions were defined relative to REF.

The algorithm detected IMEs for most islands, whether in oligotrophic gyres or in more productive equatorial regions. Islands with the strongest, most far-reaching impacts on average Chl include the Marquesas, Fiji/Tonga, Solomon, Kiribati, and the Galapagos (Fig. 1). Most IMEs are strongly seasonal, such that an average map does not adequately render the IME prevalence or strength. When applied to climatological maps (Fig. 1 inserts), the method detected an IME near 99% of islands (Table 1). Some of these IMEs only represent weak Chl increases because climatological averages smooth the IME signal, but their presence indicates that an IME likely occurred during the satellite time period. A more conservative approach still identified IMEs near 90% of islands (right column). If anything, the IME prevalence may be underestimated as small IMEs may not be detected using a 4-km resolution product (see Table S1). This confirms that the IME is nearly ubiquitous in the tropical Pacific [START_REF] Gove | Near-island biological hotspots in barren ocean basins[END_REF] . Overall, our results indicate that the IME impacts 3% of the tropical Pacific area although islands and reefs together only represent 0.4%.

Island impacts on phytoplankton biomass and production

Local IME impacts were assessed by comparing the paired IME and REF regions, and total impacts calculated by summing the results over the entire tropical Pacific for each climatological month and averaging over time. The results reveal a strong impact of islands on surface phytoplankton biomass (using Chl as a proxy) and on satellite-derived primary production [START_REF] Behrenfeld | Photosynthetic rates derived from satellitebased chlorophyll concentration[END_REF] (Table 1). Chl increases by 9% and primary production by 3% on average within IME regions.

Next to the islands, impacts are even more dramatic with a Chl increase of 26% on average. The apparent higher impact on Chl than primary production is partially due to the lower spatial resolution of the primary production product (9 km vs 4 km for Chl), combined with the fact that pixels closest to islands, where impacts are greatest, must be removed (see Methods).

While local impacts are very high, islands seem to increase Chl and primary production by less than 1% over the tropical Pacific (Table 1). These numbers may be underestimated because of removing shallow pixels near islands where impacts are greatest, and because our algorithm misses delayed IMEs occurring offshore 26 by assuming that the IME region is connected to the island. Although Chl measured by satellites is only representative of approximately a fifth of the euphotic zone, the relative impact on total vertically integrated phytoplankton biomass may be expected to be of the same order of magnitude as the impact on Chl since IME enrichments typically occur over the full euphotic zone [START_REF] Gove | Near-island biological hotspots in barren ocean basins[END_REF] .

The overall primary production increase around 0.05 PgC/yr (Table 1) can be compared to other processes, for which regional estimates of the nitrate supply carbon-equivalent (potential new production) are available. Potential new production represents an upper bound for new production, itself representing less than half of primary production in the region [START_REF] Laws | Temperature effects on export production in the open ocean[END_REF] , which provides a basis for rough comparisons with the IME even though island-induced nutrient supply is unknown. These other processes include wind-driven upwelling (1.8 to 3.9 PgC/yr including equatorial upwelling when adapting past results to the region [START_REF] Messié | A global analysis of ENSO synchrony: the oceans' biological response to physical forcing[END_REF] ), turbulent vertical mixing at the nitracline (0.4 PgC/yr for the region 6 ), nitrogen fixation (around 0.2 PgC/yr for the Pacific [START_REF] Luo | Data-based assessment of environmental controls on global marine nitrogen fixation[END_REF] , noting that nitrogen fixation may be partly supported by IMEs [START_REF] Shiozaki | Large-scale impact of the island mass effect through nitrogen fixation in the western South Pacific Ocean[END_REF][START_REF] Messié | The delayed island mass effect: How islands can remotely trigger blooms in the oligotrophic ocean[END_REF] ), and the Peru upwelling system (0.1 PgC/yr [START_REF] Messié | Seasonal regulation of primary production in eastern boundary upwelling systems[END_REF] ). Consequently, despite strong local impacts, islands are unlikely to represent a major source of nutrients for phytoplankton in the tropical Pacific and to play an important role in the global carbon budget.

Island impacts on phytoplankton taxonomy

Assessing island impacts on phytoplankton species composition is a challenging proposition.

There is at present no in situ dataset with the taxonomic and spatiotemporal coverage needed to describe phytoplankton community structure and biodiversity throughout the tropical Pacific.

Significant progress has been made towards identifying phytoplankton taxonomy from space [START_REF] Mouw | A Consumer's guide to satellite remote sensing of multiple phytoplankton groups in the global ocean[END_REF] , but published methods only identify a small number of broad taxonomic groups or size classes.

To circumvent the lack of taxonomic resolution in satellite products, we used PHYSAT 37 , a method clustering anomalies in the ocean color signal into 61 phenological bio-optical classes [START_REF] Rêve-Lamarche | Ocean Color Radiance Anomalies in the North Sea[END_REF] (hereafter phenoclasses, see Methods). Because phytoplankton characteristics such as cell size, composition, intracellular structure, cell arrangement, and absorption impact the ocean color signal, phenoclasses are representative of various phytoplankton communities [START_REF] Alvain | Theoretical analysis of ocean color radiances anomalies and implications for phytoplankton groups detection in case 1 waters[END_REF] . We applied classical ecological metrics to phenoclasses, capturing changes in phenoclass composition and diversity between IME and REF regions. These ecological metrics describe island-driven changes in phenoclasses, themselves revealing changes in phytoplankton taxonomy.

Island impacts on phytoplankton community composition were studied using the Bray-Curtis dissimilarity index applied to phenoclasses (Fig. 2a). High phenoclass dissimilarity was identified between IME and REF regions for most islands, particularly at low latitudes, suggesting a strong island impact on phytoplankton community composition. These differences are considerably higher than between random sets of pixels encompassing the IME and REF regions (Fig. 3a left), confirming that they are significant and not due to random spatial heterogeneity in PHYSAT phenoclasses. We looked more closely at the most common phenoclasses found in the tropical Pacific. These are part of "labeled" phenoclasses that were matched to dominant broad taxonomic groups thanks to coincident in situ data. The corresponding phytoplankton groups are mostly Prochlorococcus, followed by nanoplankton and Synechococcus, consistent with known phytoplankton composition in the region [START_REF] Mackey | Phytoplankton abundances and community structure in the equatorial Pacific[END_REF] .

Prochlorococcus-labeled phenoclasses significantly decreased in proportion within the IME region relative to REF, while Synechococcus-and nanoplankton-labeled phenoclasses both increased, albeit non-significantly for nanoplankton (Fig. 3a right). This is coherent with reports of Synechococcus and nanoplankton outcompeting Prochlorococcus at higher nutrient levels [START_REF] Johnson | Niche partitioning among Prochlorococcus ecotypes along ocean-scale environmental gradients[END_REF][START_REF] Martiny | Widespread metabolic potential for nitrite and nitrate assimilation among Prochlorococcus ecotypes[END_REF] .

Island impacts on phytoplankton biodiversity were investigated using several dimensions of phenoclass diversity: richness (number of distinct phenoclasses), evenness (phenoclass proportion homogeneity), and the Shannon index, a widely used biodiversity metric that accounts for both richness and evenness (Table 1). On average, phenoclass richness strongly increases near islands, more than Chl and primary production. The island-driven phenoclass richness increase is spatially variable (Fig. 2b), highest poleward of 10° latitude in both hemispheres.

There is no impact on evenness, and a smaller impact on Shannon diversity. Part of the richness increase simply arises because, by definition, Chl is higher in IME than REF regions (Fig. 3b, left). Indeed, phenoclass richness is strongly correlated with Chl (r = 0.72 across REF regions, Extended Fig. 3), consistent with in situ phytoplankton richness patterns in low productivity waters [START_REF] Vallina | Global relationship between phytoplankton diversity and productivity in the ocean[END_REF] . However, the island-driven increase in phenoclass richness is only weakly correlated to the Chl increase (r = 0.22), suggesting that this Chl signal only explains part of the phenoclass richness increase. We randomly selected two thirds of the IME and REF regions with similar Chl characteristics, effectively removing the Chl signal (Extended Fig. 4). A total of 1,000 random permutations were selected, and 33% of permutations still displayed significantly higher phenoclass richness within the IME subset (Fig. 3b,right). Taken together, these results suggest that the observed island-driven increase in phenoclass richness is not only linked to increased Chl, but also partly due to some island-specific phenomenon. We hypothesize that some islands release nutrients with ratios different from the ones of ambient waters, depending on soil composition and human activities, which could favor different species and increase phytoplankton richness [START_REF] Dutkiewicz | Dimensions of marine phytoplankton diversity[END_REF] . By contrast, weaker taxonomic impacts would be expected near seamounts [START_REF] Dai | The seamount effect on phytoplankton in the tropical western Pacific[END_REF] , because seamount-driven enrichments result from upwelling and mixing [START_REF] Leitner | Evidence for long-term seamountinduced chlorophyll enhancements[END_REF] of water masses close to Redfield ratios.

Our satellite-based findings provide compelling evidence for a strong IME impact on phytoplankton community composition and biodiversity. While PHYSAT is only a proxy for phytoplankton taxonomy, our results match previous reports from the Marquesas islands, including a shift from Prochlorococcus to Synechococcus and an increase in phytoplankton biodiversity leeward of the islands [START_REF] Caputi | Community-level responses to iron availability in open ocean plankton ecosystems[END_REF][START_REF] Martinez | Plankton spatial variability within the Marquesas archipelago, South Pacific[END_REF] . This island-driven increase in phytoplankton biodiversity may be a crucial piece contributing to islands being biodiversity hotspots in the world oceans [START_REF] Bowen | The origins of tropical marine biodiversity[END_REF] .

Island effects could also contribute to the observed latitudinal maximum phytoplankton richness in the tropics [START_REF] Righetti | Global pattern of phytoplankton diversity driven by temperature and environmental variability[END_REF][START_REF] Ibarbalz | Global trends in marine plankton diversity across kingdoms of life[END_REF] , since islands can export biodiversity to surrounding waters [START_REF] Bowen | The origins of tropical marine biodiversity[END_REF] . Observations of phytoplankton taxonomy around other islands are needed to confirm PHYSAT-inferred island impacts on phytoplankton community composition and biodiversity.

Regardless of impacts on phytoplankton taxonomy, local impacts on biomass and productivity are so high that regions enriched by IMEs represent oases in an otherwise largely unproductive environment (Fig. 1). There is strong evidence that they attract fish and marine predators [START_REF] Worm | Predator diversity hotspots in the blue ocean[END_REF][START_REF] Block | Tracking apex marine predator movements in a dynamic ocean[END_REF] , and represent important stopovers along marine migration corridors [START_REF] Harrison | The political biogeography of migratory marine predators[END_REF] . While fishery data would be biased for islands (due to confounding effects of higher fish biomass and proximity), a recent study of seamounts found a more than doubled fish catch at seamounts with Chl enhancements relative to seamounts without [START_REF] Leitner | Evidence for long-term seamountinduced chlorophyll enhancements[END_REF] . Some islands such as Hawaii and the Galapagos also represent key conservation sites deemed irreplaceable because of the presence of endemic marine species [START_REF] Pompa | Global distribution and conservation of marine mammals[END_REF] . This suggests that islands have profound ecological consequences both at the local and basin scale, even though large-scale impacts on primary production appear to be small. Because GSHHG was constructed from databases that were built in the 70s and 80s, errors remained in the location of some islands. Islands being too numerous to all be validated, only islands from the final database (see below) were checked against GEBCO bathymetry, and where obvious discrepancies existed, their position was shifted accordingly. The island database was then reprocessed until no more discrepancy was found (total corrected islands: n=32). The island database was merged with a published database of 1,779 islands 51 by finding, for each island from the Nunn et al. database [START_REF] Nunn | Classifying Pacific islands[END_REF] , the closest GSHHS contour. The Nunn et al. database [START_REF] Nunn | Classifying Pacific islands[END_REF] provides more precise information regarding position, elevation, island type, and area. Last, reefs were detected from GEBCO (at < 500 m resolution) as groups of pixels shallower than 30 m ("shallow zones", n=5,972), that include both submerged reefs and emerged islands. Island and reef databases were merged by finding islands within shallow zones, when they existed. The combined dataset after removing contours within the east/west mask (e.g., Atlantic, Indonesia) includes 16,051 islands and reefs (hereafter "islands"). Islands within 100 km of the tropical Pacific east/west borders were removed to avoid continental influences (n=5,062). The remaining islands were then combined within the MODIS shallow mask (see section above and Fig. S1).

Tables

The term "island" in the paper thus refers to a group of islands/reefs belonging to a set of connected shallow pixels. The final database includes 664 islands (437 with emerged lands, including 363 from the Nunn et al. island database [START_REF] Nunn | Classifying Pacific islands[END_REF] , and 227 shallow reefs).

IME detection.

The IME was defined for each island as the smallest possible Chl contour enclosing the island that fulfills a list of criteria detailed below (see Fig. S2 for a representation of the algorithm). Beforehand, the maximum (Chl_max) and minimum (Chl_min) nearby Chl were obtained for each island within a 1-pixel band around the island mask. Islands were ranked by Chl_min, and processed from lowest to highest Chl_min. For a given island, the IME Chl contour (termed cChl) was iteratively lowered by 0.01 mg m -3 starting at Chl_max and the corresponding IME mask computed. The IME mask includes both pixels above cChl and adjacent missing data, such that other islands can become part of the same IME, then termed "shared IME". When this happened, Chl_max was adjusted to the highest value; Chl_min does not need adjustment since islands are processed in Chl_min order. The iteration was stopped when one of the following conditions was met: (1) cChl < Chl_min (the rationale being that currents displace the nutrient enrichment downstream of the island, so that at least one pixel surrounding the island should not belong to the IME); (2) the IME mask was too large, either touching the domain borders, or touching the continent masks or adjacent NaN pixels (this happens when contours enclose the full oligotrophic gyre); (3) regions of high Chl (> 0.8*Chl_max) were found within the IME mask, further than 32 pixels away from any island (~ 150 km). In this last case, the goal was to avoid non-island sources of nutrients within the IME region such as open-ocean eddies or upwelling; the 32-pixel tolerance deals with cases where the Chl maximum is displaced downstream of the islands [START_REF] Hasegawa | How islands cause phytoplankton to bloom in their wakes[END_REF] . The IME peak can occur even further downstream, notably in cases of delayed IME 26 ; 32 pixels thus represents a compromise between capturing most IMEs and avoiding non-IME local Chl enrichments. While sensitive to the parameters used, this criterium only concerned 1.3% of cases (for the monthly climatology); in 95% of cases, the algorithm stops due to criterion #2. When one of the 3 criteria was met, a second iteration was performed at higher resolution (0.001 mg m -3 ) starting with the last cChl until meeting the criteria again, such that cChl was determined with a 0.001 mg m -3 accuracy. This is well beyond measured Chl accuracy, but small changes in cChl can result in large changes in IME areas on climatological averages, hence the need for high sensitivity. The IME was only kept if the IME mask contained at least 2 Chl pixels. The IME detection algorithm is available at https://bitbucket.org/messiem/toolbox_IME_detection. Satellite-derived information on phytoplankton biomass and primary production. Island impacts were assessed using satellite chlorophyll-a (Chl), a common proxy for phytoplankton biomass [START_REF] Platt | Oceanic Primary Production: Estimation by Remote Sensing at Local and Regional Scales[END_REF] representative of the top ~ 10-30 m in our region (first optical depth). Subsurface impacts remain unknown; in some cases, apparent surface enrichments can result from the passive uplift of the deep chlorophyll maximum without any net biomass increase [START_REF] Hasegawa | Apparent phytoplankton bloom due to island mass effect[END_REF] . However, in situ profiles available near islands suggest this is the exception rather than the rule 15 (see also Table S3). Island impacts on primary production were estimated using the MODIS-based standard Vertically Generalized Production Model 31 (VGPM). The VGPM estimates primary production integrated over the euphotic depth range based on satellite chlorophyll, light availability, and temperature (a proxy for nutrient availability), and has been widely used for large-scale studies for which the spatiotemporal coverage of in situ data remains insufficient.

Results are similar when using a more recent primary production algorithm (CAFE model 55 ): total IME-induced PP increase = 44.9 TgC/yr vs 50.4 TgC/yr for the VGPM (Table 1). Primary production was downloaded from the Ocean Productivity website (http://science.oregonstate.edu/ocean.productivity/index.php) at 9 km resolution for the period July 2002 -December 2018 (see above for Chl data information). Primary production maps were averaged into a monthly climatology, pixels shallower than 30 m removed, and data interpolated on the Chl grid (4 km resolution). The lower resolution of the primary production product means that areas larger than for Chl were impacted by the shallow pixel removal, effectively removing high values near islands more than for Chl; the corresponding pixels on the Chl grid (i.e. outside of the Chl shallow mask) were interpolated using a median filter.

Island-driven impacts on chlorophyll and primary production. Island impacts were assessed by contrasting data in the IME region to data in a reference region (REF), defined as the closest N pixels from the island mask that do not belong to any IME region, where N is the number of pixels within the IME region excluding the shallow mask (Extended Fig. 1). When assessing the island impact on variables other than chlorophyll (i.e. primary production or PHYSAT), the region with the largest number of data pixels was adapted. Indeed, different datasets may have different data gaps, thus changing the number of data points in each region. To ensure that the number of data points remained identical in both regions, the region with most pixels was randomly subsampled to match the region with fewer pixels. The REF region was used to define the nearby Chl increase for each island (Chl_max relative to average Chl within REF). Detecting IMEs using a high sensitivity is justified on a climatological basis where spatial variability is heavily smoothed by a 17-year average; however, weak increases could result from noise.

Statistics in Table 1 are thus presented both for all IMEs (more exhaustive) and after excluding IMEs with Chl increases near islands below 10% (more conservative).

PHYSAT. The PHYSAT method 37 is based on daily, 4-km resolution normalized water-leaving radiance (primary variable measured by a satellite ocean color radiometer after atmospheric correction, for several wavelengths). First, spectral radiance anomalies (Ra) are computed by removing a reference spectrum function of Chl for the same pixel, ensuring that the first order chlorophyll signal is removed. Then, these anomalies are clustered using an automatic unsupervised classification approach (self-organizing maps), classifying daily Ra into 100 "neuron groups" corresponding to a specific Ra spectral frequency shape and amplitude [START_REF] Ben Mustapha | Automatic classification of water-leaving radiance anomalies from global SeaWiFS imagery: Application to the detection of phytoplankton groups in open ocean waters[END_REF] . The number of neuron groups is reduced using phenological metrics to identify signals linked to specific phytoplankton assemblages [START_REF] Rêve-Lamarche | Ocean Color Radiance Anomalies in the North Sea[END_REF] , termed "phenoclasses" (61 for PHYSAT applied to MODIS-Aqua). A previous version of PHYSAT was applied to the SeaWiFS satellite and matched with coincident in situ phytoplankton data, which enabled SeaWiFS phenoclasses to be labeled with six broad phytoplankton groups [START_REF] Alvain | Seasonal distribution and succession of dominant phytoplankton groups in the global ocean: A satellite view[END_REF] . Phytoplankton labels are also available for MODIS phenoclasses, through SeaWiFS/MODIS matchups during their overlapping period. PHYSAT ecological metrics. Classical ecological metrics were computed from phenoclass proportions averaged in each IME and REF region, by regarding each phenoclass as a "species" in mathematical equations for each index. In practice, each phenoclass can contain varying numbers of species. However, phytoplankton richness is relatively stable in the tropics [START_REF] Righetti | Global pattern of phytoplankton diversity driven by temperature and environmental variability[END_REF] , so that the number of phytoplankton species belonging to each phenoclass should be relatively constant.

Island impacts on phenoclass composition were assessed using the Bray-Curtis dissimilarity index [START_REF] Bray | An Ordination of the Upland Forest Communities of Southern Wisconsin[END_REF] between each pair of IME and REF regions. The Bray-Curtis index can vary between 0 and 1, where 0 would indicate that IME and REF have the same phenoclass composition, and 1 that they do not share any phenoclasses. Island impacts on phenoclass diversity were assessed using various biodiversity metrics: richness, Pielou's evenness [START_REF] Pielou | The measurement of diversity in different types of biological collections[END_REF] , and the Shannon index 60 . These metrics were computed in each IME and REF regions separately, and contrasted (similar to chlorophyll and primary production). Just like true species richness strongly depends on sampling effort, phenoclass richness increases with the number of pixels over which it is computed (see Fig. S3). Phenoclass richness was corrected by rarefaction to 100 pixels to enable direct statistical comparisons of richness across regions [START_REF] Colwell | Interpolating, extrapolating, and comparing incidence-based species accumulation curves[END_REF] . Computing biodiversity indices from satellite products of phytoplankton taxonomy is not new. A previous study computed global Shannon diversity metrics from PHYSAT six broad phytoplankton groups, identifying regional hotspots matching known biodiversity hotspots [START_REF] De Monte | Can we detect oceanic biodiversity hotspots from space?[END_REF] . While precise biodiversity estimates require an extensive knowledge of the community, the De Monte index worked by capturing spatial heterogeneity in dominant phytoplankton groups, which was shown to be highly correlated to phytoplankton biodiversity in a model [START_REF] Soccodato | Estimating planktonic diversity through spatial dominance patterns in a model ocean[END_REF] . Here, by applying a similar method but using all 61 phenoclasses, we are exploiting the full power of the PHYSAT algorithm and capturing a more precise picture of changes in phytoplankton taxonomy and biodiversity. This is a very powerful approach because it bypasses the need to identify phytoplankton taxonomy from space. While PHYSAT is only a proxy for phytoplankton taxonomy, broad phenoclass diversity patterns match published phytoplankton biodiversity patterns such as increasing richness with phytoplankton biomass in unproductive waters 43 (Extended Fig. 3). Phenoclass richness was normalized to 100 data points, and only regions with at least 100 PHYSAT data points were included.

Extended Data

Figure 1 :

 1 Figure 1: Map of IME detection in the tropical Pacific. The main map represents the 2002-

Figure 2 :

 2 Figure 2: Maps of island impacts on PHYSAT phenoclasses, indicative of impacts on

Figure 3 :Figure 1 . Figure 2 . 17 279 3 .

 312173 Figure 3: Island impacts on phytoplankton community structure as depicted by PHYSAT.

  Around half of MODIS phenoclasses remain unlabeled, but could be matched to phytoplankton groups as more samples become available. The most common phenoclasses present in the tropical Pacific were labeled and found to be dominated by Prochlorococcus, Synechococcus, and nanoplankton. Daily MODIS phenoclasses (4 km resolution, July 2002 -April 2018) were averaged as a monthly climatology of phenoclass occurrence frequency at each pixel; pixels shallower than 30 m were removed. The corresponding product was used to calculate the phenoclass composition (percentage of occurrence for each phenoclass) within each IME and REF region detected previously. Ecological metrics were only computed in IME and REF regions including at least 100 PHYSAT data pixels, to ensure adequate PHYSAT coverage. This represents around half of the detected IMEs.

Fig. 2 :

 2 IME maps for different climatological months. For each month, IME regions are contoured in different shades of red depending on Chl increase near islands relative to a reference region (similar to Fig. 1). Extended Data Fig. 3: PHYSAT phenoclass richness vs Chl across IME and REF regions.

Table 1 : IME impacts in the tropical Pacific. IME

 1 prevalence is defined based on islands belonging to an IME region (there can be several islands associated with one IME region)."Average" impact refers to impact for a single IME, averaged over all detected IMEs. They include both change in ambient conditions in IME vs REF regions, and total island-driven increase summed over the IME area. "Total" impact refers to impacts summed over the entire study region and averaged over a climatological year. Phenoclass diversity impacts were computed for IME/REF regions of at least 100 PHYSAT data points, and richness was normalized to 100 data points to correct for the strong dependence of richness on area sampled (see Methods). Statistics are given for all IMEs, and for a more conservative subset excluding those where the island nearby Chl increase was below 10%. Additional metrics (median and interquartile range) are provided in Extended Table1.

		IMEs with Chl
	All IMEs	increase nearby
		islands ≥ 10%

Acknowledgements M.M. was funded by the European Union's Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement SAPPHIRE No. 746530, and by the David and Lucile Packard Foundation. The project leading to this publication has received funding from

European FEDER Fund under project 1166-39417 (M.M., A.P., A.D.). We thank Anne-Hélène Rêve-Lamarche and David Dessailly for their help extracting and using the PHYSAT outputs, and Eric Pape for useful comments and text edits. The box plots in Fig. 3 were generated using the IoSR Matlab toolbox (https://github.com/IoSR-Surrey/MatlabToolbox), and maps displayed using m_map (https://www.eoas.ubc.ca/~rich/map.html).

Data availability statement

The main outputs of this study, including the island database, IME and REF masks, and IME impacts on chlorophyll, primary production, and PHYSAT, are available as a dataset hosted on Zenodo [START_REF] Messié | Data from: Basinscale biogeochemical and ecological impacts of islands in the tropical Pacific Ocean (v1.0.0)[END_REF] . The PHYSAT climatology calculated for this paper is available there as well;

PHYSAT is now being processed by ACRI (https://www.acri-st.fr/) and PHYSAT data will soon be publicly available from their website. Other data that support the findings of this study are available in various public repositories: https://coastwatch.pfeg.noaa.gov/erddap/info/index.html (MODIS chlorophyll concentration), http://science.oregonstate.edu/ocean.productivity/index.php (MODIS primary production), https://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html (GSHHG coastline), https://www.gebco.net/data_and_products/gridded_bathymetry_data/ (GEBCO bathymetry). The Nunn et al. ( 2016) island database is available as an additional file accompanying their paper (https://doi.org/10.1186/s40562-016-0041-8).

Code availability statement

The IME detection algorithm, along with datasets and example code to reproduce Fig. 1, Extended Fig. 1, and parts of Table 1, is available at https://github.com/messiem/toolbox_IME_detection and the corresponding release published on Zenodo [START_REF] Messié | Code for: Basin-scale biogeochemical and ecological impacts of islands in the tropical Pacific Ocean (v1.0.0)[END_REF] .

Author Contributions Statement

M.M. conceived and designed the study, with input from A.P., A.D., and S.A. M.M. developed the IME algorithm with input from A.P. and A.D., performed the data analyses, and led the interpretations and writing. S.A. provided the PHYSAT outputs. A.P., A.D., E.M., and S.A. provided significant input on the text, and contributed to discussions that shaped the study and the manuscript.

Competing Interests Statement

The authors declare no competing interests.

Methods

IME detection data sets. The IME was detected from a climatology of MODIS satellite surface chlorophyll-a concentrations (Chl, 4 km, monthly from July 2002 to December 2018, erdMH1chlamday product downloaded from https://coastwatch.pfeg.noaa.gov/erddap/info/index.html). The study was based on the 4 km MODIS Chl grid in the tropical Pacific (30°N/30°S; east/west borders are roughly delimited by the Americas, Australia, Indonesia, Philippines, and Taiwan, see Fig. 1). Islands were detected from the Global Self-consistent, Hierarchical, High-resolution Geography Database (GSHHG) version 2.3.7 full resolution coastline (https://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html) loaded using functions from the m_map toolbox (https://www.eoas.ubc.ca/~rich/map.html).

Bathymetry was obtained from the GEBCO global bathymetry (https://www.gebco.net/data_and_products/gridded_bathymetry_data/) at 1/15' resolution (< 500 m). A 4 km resolution "shallow mask" was generated for the MODIS grid, including all pixels containing land shallower than 30 m according to GEBCO or where an island was detected. The shallow mask was extended by one additional pixel in all directions to ensure that all pixels containing shallow waters were flagged [START_REF] Gove | Near-island biological hotspots in barren ocean basins[END_REF] . All ocean color data (Chl, primary production, and PHYSAT, see below) were removed within the shallow mask as they were potentially contaminated by bottom reflectance [START_REF] Gove | Near-island biological hotspots in barren ocean basins[END_REF] . In practice, pixels within the shallow mask (containing land, waters shallower than 30 m, and adjacent pixels) were treated as land.

Island database. The island database includes both emerged islands and reefs shallower than 30 m according to the GEBCO bathymetry. The reason is that some atolls can have no consistent (e.g., tide-dependent) or very little emerged land, and can potentially be missed both by GSHHG and by the GEBCO bathymetry. Islands and reefs were identified as follows. Islands were values for total Chl and total primary production (intentionally kept in the same unit as in Table 1) highlight how a few major IMEs (visible in Fig. 1) are responsible for most of the large-scale impact on Chl and primary production.


Guillaume Munch-Maccagnoni

Efficient "out of heap" pointers for multicore OCaml

Introduction

This paper reports an experiment with a large pages allocator for the OCaml runtime, with measured performance improvements. A large pages allocator (also known in the literature under other names: superpages, etc.) is a standard component of a memory allocator that stands between the OS and user-facing allocators (e.g. minor and major heaps) and which reserves and manages large chunks of contiguous memory. The OCaml runtime currently gives up a good amount of control by assigning this role to the system allocator. Other languages have a simple implementation from which practical lessons can be learnt (especially in terms of portability), such as the one from the Go runtime.

Control over large pages affect (traditionally) the components implementing virtual address translation (hardware-level page table, translation lookaside buffer), in particular by leveraging (hardware-level) huge pages. It also enables (more specifically) efficient implementations of the OCaml page table, a data structure used in various parts of the OCaml runtime to classify pointers, to distinguish for instance which blocks belong to the heaps and which ones are "out of heap" during the marking phase of the GC.

One goal was to evaluate the possible performance of a page table for multicore OCaml. Whilst I did not use original techniques, some of the results are unexpected a priori based on beliefs expressed in the OCaml community. In particular, the analysis shows that a page table can speed-up marking, a phenomenon which we reproduced in real-world programs.

In essence, this paper reports the good hypothetical performance, in rigorous practical terms, of embedding (borrowing) linearly-allocated values inside garbage-collected values. A companion submission to the ML workshop reports a symmetrical result: how to efficiently embed (own) garbage-collected values inside linearly-allocated values. Taken together, the broader motivation is to show the feasibility of basing linear allocation with re-use in languages that would still leverage state-of-art garbage collection for non-linear values.

Page table

The page table in OCaml 4 stores information about the memory layout of the process at a granularity of 4kB OS pages. It has a fairly inefficient implementation on 64-bit systems using a hash table with linear probing. Its size grows linearly with the size of the heap and tends to suffer from collisions. It has for a long time been criticised for its performance overhead in 64-bit programs especially with large heaps, leading to the introduction of a compilation option called "no naked pointers" avoiding page * Guillaume.Munch-Maccagnoni@inria.fr table checks in several performance-critical locations, at the cost of stricter programming constraints. Furthermore, porting this data structure to multicore OCaml was considered impossible due to synchronisation costs.

Out of heap pointers

To permit the complete removal of a page table, most forms of out-of-heap pointers have been deprecated starting from OCaml 4.11. I presented some time ago a position paper (Munch-Maccagnoni, 2020) defending opportunities for the alternative (of preserving out of heap pointers), and identifying and addressing four challenges for a more efficient page table design compatible with multicore OCaml.

One proposed application is for integrating linear-allocation with re-use in languages that use a GC for managing non-linear values. Linear allocation with re-use is a programming technique inspired by linear logic [START_REF] Lafont | The linear abstract machine[END_REF][START_REF] Henry | Lively linear lisp: "Look ma, no garbage![END_REF], also more recently advocated and expanded under the name "functional but in-place" by Reinking, Xie, de Moura, and Leijen, 2021. A page table (or something to this effect to let the GC tell values apart) enables the embedding (borrowing) of linearly-allocated values inside GC-allocated values, in a way reminiscent of sharing from functional programming. More background on the motivations, and perspectives in link with linear allocation, are given in Appendix A. Now, Munch-Maccagnoni (2020) did not experiment with an implementation, which is the subject of the present work.

Since, and independently, the marking loop of OCaml's GC has been rewritten in order to leverage memory-level parallelism in the CPU using prefetching, and tightly optimised, with a main loop spanning a few CPU instructions.1 This further challenged the prospects of an efficient page table, since it was not clear how to leverage memory-level parallelism with this additional lookup, nor whether the processor core had enough resources left during the optimized marking for any such lookup not to cause a noticeable slowdown.

In other words, doubts were raised, independently from OCaml's own choices, that the theorised mixed memory management technique might fundamentally involve a performance trade-off; a claim that seemed to go beyond OCaml.

Other uses A large page allocator is also useful to implement support for hardware-level huge pages, for instance via Transparent Huge Pages (THP) in Linux. Hardware huge pages reduce the cost of cache misses by reducing the chances of TLB miss, and therefore are beneficial to both the garbage collector and the mutator in the presence of large heaps. OCaml currently has an option to use huge pages in Linux, but it is difficult to set up, and only affects the major heap, while users report large benefits of having also a very large minor heap in some use-cases. In addition, OCaml multicore has a new allocator that currently lacks this support. OCaml minor and major heaps are particularly suitable for huge pages, and the lack of proper support represented a missed optimisation opportunity.

In the future, a large page allocator or something to this effect could be useful for targets that only offer an sbrk-style interface to allocate memory (WebAssembly and bare metal). A page table can also let the layout of minor heaps be relaxed in OCaml 5 (they currently have to be allocated contiguously to implement an efficient "is young?" check); this could simplify for instance the implementation of adaptive sizing for the minor heaps (Jones, Hosking, and Moss, 2011, 7.7).

Experiment

The following is an abridged version of https://gitlab.com/gadmm/ocaml-large-pages-experiment, which describes the complete experiment and its results in more details.

Implementation I have implemented a best-fit allocator that manages large chunks of virtual memory (2 𝑁 bytes reserved, not allocated, per chunk), and subdivides it into smaller chunks of memory allocated on request (multiples of 2 𝑀 bytes where 𝑀 < 𝑁). Virtual memory is reserved as needed, preferably contiguously to other chunks. I took 2 𝑁 = 256 MB and 2 𝑀 = 2 MB (the size of a huge page on x86-64) for the parameters in this experiment. The implementation reuses generic data structures of the OCaml runtime: it consists in two skip-lists storing the free chunks by address and by size (respectively), with coalescing. For a simple implementation, lookup and insertion have a logarithmic average time that is fitting for a data structure which remains small and is used infrequently (e.g. when the major heap is expanded).

The new page table is implemented with a 1-level BiBoP ("big bag of pages", like OCaml's 32-bit page table implementation), whose entries describe these 2 𝑁 bytes chunks; i.e. a table indexed by the (48 -𝑁) most significant bits of the addresses of the chunks. It is subject to a monotonicity constraint which is realistic for practical use-cases of the page table, as described in [START_REF] Munch-Maccagnoni | Towards better systems programming in OCaml with out-of-heap allocation[END_REF]. Page protection tricks are used to allocate the table on demand (this turned out to be a secondary aspect not needed for efficiency, with several plausible alternatives). Some care and exploration were used to fit the assembly-optimised style of the marking loop.

The strategy to fit the prefetching algorithm is to simply consider that the page table entries are very likely to be in L1 cache. A back-of-the-envelope calculation indeed shows that the data needed by the marking loop (including memory being prefetched) fits on average a small portion of the L1d cache available on modern processors (≥ 32KB). Now each cache line of the page table describes 2 𝑁+6 bytes of contiguous memory, when our allocator tries to allocate as contiguously as possible. So in practice the page table does not use more than a couple additional of lines of L1d cache. Hence the page table does not need to be prefetched itself, does not significantly affect the rate of false evictions, nor do its accesses compete with prefetching resources (e.g. line fill buffers). In this situation, depending on instruction-level parallelism, it is possible that the page-table test costs nothing. Some auxiliary tables are used for certain kinds of entries that require a smaller granularity (e.g. static data). For these I re-used the data structures of my best-fit allocator. This improves over those which already exist in OCaml thanks to coalescing. These auxiliary tables, although efficient, are not visited inside the marking loop.

I have also implemented the synchronisation code that is needed inside the marking loop for an implementation in multicore OCaml. There are two options:

1. The synchronisation code tests if the page table entry is empty. If so, a compare_exchange is attempted in order to taint the page table entry with a special value, which in case of success indicates that the value was an actual out-of-heap pointer (otherwise the up-to-date value is loaded). Thanks to the monotonicity constraint, we know that this synchronisation path is taken very infrequently in the presence of multiple domains (at most once per domain and per 2 𝑁bytes page table entry; much less in practice because it is only executed in case of races). Therefore we can reason that the performance differences in the single-core benchmarks are representative of multicore. Notably, effects of code size and branch prediction are correctly taken into account.

2. More efficiently, by relying on dependency ordering on platforms with a very weak memory model (e.g. Arm, and thus stronger models such as x86), no extra synchronisation is needed. The downside is that no tainting is performed to detect when the monotonicity condition is broken. Since there is no synchronisation and no contention, the performance in single-core is again representative of multicore.

Unless indicated otherwise, this paper presents results for the first implementation.

Finally, I have implemented an option to use huge-page allocation with Linux's THP for OCaml's heaps, which I tested separately.

Benchmark The baseline of my experiment is Stephen Dolan's optimised GC implementation with prefetching ("Speed up GC by prefetching during marking" ocaml/ocaml#10195) rebased on top of OCaml 4.12. The new large page allocator and page table were implemented on top of it.2 I compared the performance of the "no-naked-pointer" mode (which avoids a page table check during marking) with the legacy and the new optimised page table using synthetic benchmarks.

Care needed to be taken to compare equals for equals: even small changes in GC patterns (for instance due to changing minor heap size slightly) would have changed the results significantly due to threshold effects, and rendered the comparison meaningless.

The synthetic benchmark is inspired by the one proposed by Dolan in his experiment. It consists in allocating a large quantity of values (ranging from 800MB to 11GB) distributed randomly, and so it constitutes a worst case in terms of cache locality. One measures the major GC duration and other statistics.

I have improved the synthetic benchmark by introducing variables such as the proportion of immediates, proportion of statically-allocated blocks (to measure the benefits of skipping during marking, an optimisation which a page table permits), randomness of the heap (to measure the effect of load stalls), and randomness of the block layout (to measure effects on branch prediction). I have instrumented the OCaml runtime to measure how fast mark slices run, how often statically-allocated blocks data was encountered, and how diverse (non cache-local) the static data visited during marking was.

With the synthetic benchmark, care was taken to control in various ways for measurement biases caused by code layout, but this effect was rarely important.

The impact of huge pages (THP) was also measured, separately from that of the page table. The two features are orthogonal from each other.

I have also obtained results on real-world OCaml and Coq workloads, however they show greater variability. Controlling for code layout effects as carefully as for the synthetic benchmark was not doable, but I obtained consistent results by running the benchmarks using different compilers and compiler options (which give different memory layouts).

The benchmarks were run using an Intel Core i7-6600U (Skylake) processor, similar to Dolan's experiment, which required some care to avoid unreliable results due to a processor bug, and later reproduced with AMD Ryzen 7 5850U and Intel Core i7-1185G7 (Tiger Lake). Unless indicated otherwise, the figures reported below are for i7-6600U. In the real-program tests (running on i7-6600U and i7-1185G7), care was also taken to eliminate CPU frequency changes and CPU thermal throttling (in the case of the synthetic benchmark, this was also considered, but actually not necessary in order to obtain stable results).

Results

Contrary to the expectation that a page table would have an extravagant cost with the prefetching GC, both the "no-naked-pointers" mode and the new optimised page table bring a similar speedup of about 26% in the synthetic benchmark, which measures major GC duration, compared to the legacy page table. Furthermore, the new page table consistently outperformed slightly the optimised GC in "no-naked-pointers" mode in the synthetic benchmark, albeit negligibly (by ~1% of the major GC duration, that is ~0.15% of the duration before the prefetching patch).

To understand this result, one should consider that even without a page table, a test is still performed to skip values in the minor heap. In a sense, multicore OCaml still needs a page table of some kind 3 . The new page table turned out to be more efficient than the previous check. 4This speedup is further improved by taking the skipping of static data into account. Surprisingly, static data was found to be encountered fairly frequently during marking in real-world OCaml and Coq workloads: between 3.7% and 7.2% of values on average were skipped thanks to the page table, with spikes at 40% during some marking slices. In terms of unique cache lines, the amount of static data skipped during each marking slice would most often be too large to remain in L1 (and often L2) cache (see Figure in Appendix C). At a ratio of 5% static data skipped, the synthetic benchmark shows a speedup of ~3% (a figure that does not take into account possible costs of additional branch mispredictions this causes).

The current page table scales poorly to large heaps, and to multicore. The new page table scales to large heaps both in theory and practice, as the figures remained consistent with very large heaps. Regarding scaling to multicore OCaml, the results concerns an implementation that already supports parallel accesses to the page table. I concluded that this single-core performance is representative of the multi-core performance by a theoretical argument.

THP brings various performance improvements, from about 10% of major GC time in the synthetic benchmark with a random heap to a negligible impact with a non-random heap. (Note that only the impact of THP during marking was measured.) It brings comparable improvements whether by using my large page allocator or by using the jemalloc allocator with the option "thp:always" (by preloading from the command line). So, the interested user can already get most benefits of THP by changing the command line invocation. 5 A built-in allocator has further advantages than a global system allocator setting (besides convenience): THP is only used for memory allocations that are well-suited for it. This can become relevant if the program uses non-OCaml libraries not well-suited for THP.

In a similar area, I measured noticeable benefits, in conditions of high TLB misses, of allocating memory as contiguously as possible, which could likely be attributed to improved behaviour for the MMU cache (TLB misses completing faster, see [START_REF] Barr | Translation Caching: Skip, Don't Walk (the Page Table)[END_REF].

With the OCaml and Coq workloads, I initially observed that the "no-naked-pointers" mode and the new page table have similar performance, indistinguishable in terms of total running time given the greater amount of variability. These real-program results are hard to exploit because they are more noisy, and microarchitectural effects might be more important, unlike our experience with the synthetic benchmark.

However more recent results with Core i7-1185G7 and using the second implementation technique for the page table check (the one using only dependency ordering for synchronisation), I could indeed observe a consistent speedup of using a page table probably due to the skipping of static data, from 1-2% (with gcc) to 4-5% (with clang) of the marking slice duration, depending on compiler options. (Remember that using different compilers and compiler options was meant as a way to control to some degree for code layout effects; this seems to confirm some speedup but it does not tell by how much.)

Limitations I used a synthetic benchmark that exerts either a lot of cache misses (random heap), or very few cache misses (nonrandom heap). Real-world programs are likely in the middle, but results between a random and a non-random heap are consistent, with the exception of the impact of THP. The synthetic benchmark also falls short of simulating real-world amounts of branch mispredictions. Now the various implementations branch in similar ways, except on static data. It is yet unclear whether the benefits of skipping static data reflect in practice as strongly as in the synthetic benchmarks; this could be explained by the cost of branch mispredictions this creates.

Regarding static data usage, I have only tested OCaml and Coq on intensive workloads; it would be interesting to see how other programs visit static data during marking.

The synthetic benchmark only measures the major GC duration, while huge pages are likely to benefit the whole program. Results on varied Coq workloads measuring the benefits of huge pages and the new page table are encouraging6 .

The friendliness towards THP is due among others to memory reclamation being performed via compaction, because it frees up memory in large chunks. Without compaction, one would encounter known issues of huge pages regarding memory reclamation (whereby low amounts of fragmentation can prevent reclamation). Thus one should expect multicore OCaml, which currently lacks compaction, to be less friendly towards THP once memory reclamation is implemented.

Thanks Thanks to Stephen Dolan for invaluable discussions, patient explanations and advice. (Any error or opinion left in this work is mine.)

A. Naked pointers & linear allocation with re-use: motivations and perspectives

The usage of out-of-heap (naked) pointers in OCaml 4 falls broadly into two categories.

Interoperability & backwards-compatibility

The first usage is for interoperability, where the concern is mainly backwardscompatibility. When interacting with foreign code (for instance via the OCaml C FFI), using out-of-heap pointers is the most straightforward way to refer to foreign data inside OCaml data. This usage is now considered inferior to alternatives using some form of wrapping, essentially due to an unsoundness involving the recycling of memory by the system allocator.

For various reasons including unsoundness, most forms of naked pointers have been deprecated in OCaml 4.11. Starting with OCaml 5, the program can crash or do worse things if the GC encounters such a pointer. Compatibility risks have been evoked early on with the deprecation, according to a public comment dating back from 2015.

As we recently discovered, the use of naked pointers has been advocated for a long time in a tutorial7 that has been recommended by several popular resources from the OCaml community over the years8 .

Searching the opam repository for one specific usage pattern suggested by this tutorial reveals a large sample of affected libraries (some of which have perhaps been fixed since the deprecation was announced). A careful evaluation to eliminate falsepositives was necessary, and there is of course no guarantee of exhaustivity. (List in appendix B)

Without entering the details of why this usage of out-of-heap pointers was unsound, one can ask under which set of conditions it would materialise, given that it was apparently not an obstacle to the development of many libraries using this technique. The way the unsoundness manifests itself depends in fact on the implementation details of the system allocator; reports of this issue occurring in practice (which it does) involve specific usage patterns. As matter of fact, no practical or theoretical unsafety had been reported to the author of the tutorial during its existence.

One hypothesis is that this technique has been working reliably in many situations. This creates of course an interesting and delicate situation for backwards-compatibility. This is a usage which one reasonably wants to deprecate due to its unsoundness, yet:

1. It is possible that a good proportion of programs using these libraries is actually accidentally bug-free.

2. The existence and usage of workarounds have been reported for situations where the bug occurs (namely, forcing the GC to run before large amounts of foreign data structure are freed).

3. Some libraries that manage their own memory mapping (such as Ancient, described later) took other measures to avoid this bug.

For the sake of backwards-compatibility, a "naked pointer detector" has been proposed in OCaml 4.12, which warns when the GC encounters a naked pointer. But while this tool can prove that a program creates dangerous out-of-heap pointers, it does not prove that a program nor its dependencies do not create any. (We also do not know how well it works for users in practice.) In contrast, delicate backwards-compatibility situations in relationship to bugs are not unfamiliar to major operating systems and industrial programming languages,9 where it can be preferred to keep a bug in place (along with the work-arounds existing in user code) over breaking user code.

But the new page table presents a better alternative, which is to make these previously-dangerous uses safe, even in the event where the choice was made to keep discouraging the use of such naked pointers for new programs. Concretely, this would take the form of an option to reserve the address space in advance for the remainder of the execution10 . This option could be enabled anytime by either of the library, the final program, or even just the user of the program in case of legacy programs.

Prior to this tutorial and its publicity being brought to my attention, cases of high-profile code that must be changed were already known 11 , including the innocuous usage of NULL as a special value by some libraries 12 . In another case, an indus-trial user has resigned to maintaining a patch to OCaml for an indefinite amount of time for a key performance use-case, after a proposed alternative solution was rejected from the main compiler branch. 13 Eventually, the development of the "no-naked-pointers" mode, followed by the full removal of the page table, a data structure used pervasively in the OCaml runtime, the introduction of the "naked pointer checker", etc., have proved to require lots of efforts, some compromises, and created unexpected issues. It also caused a lot of adaptation work for some users.

The present work demonstrates that re-implementing the page table with standard and well-tested techniques (a BiBoP based on a large pages allocator, the latter of which is useful for other things as well) was a simpler, less risky and just as performant alternative.

Linear allocation

The second usage of out of heap pointers is more involved than storing foreign pointers, and concerns experimental ways of mixing garbage-collected memory with dynamically-allocated memory, for instance excluding some memory from the GC. Either for performance and resource-usage reasons (the Ancient library, which implements a persistent heap outside of the major heap) or for incompatible ownership patterns such as sharing data between processes (OCamlnet, an approach which might be revisited for some use-cases once the limitations of a stop-the-world collector will be felt). Dynamically-allocated and -deallocated memory such as Ancient and OCamlnet are not supported without a page table or something to this effect 14 .

I have in mind two experiments that would rely on the page table. The first one is to prototype a version of Ancient that performs hash-consing, specialised for the needs of the Coq proof assistant, inspired by an experiment by Pédrot which has previously shown promising gains.

The second one, where I believe my experiment is of general interest, is about linear allocation with re-use. It should now be possible to experiment with measuring benefits of this technique alongside a garbage collector to manage non-linear values.

Linear allocation with re-use is an old idea [START_REF] Lafont | The linear abstract machine[END_REF][START_REF] Henry | Lively linear lisp: "Look ma, no garbage![END_REF], which has been found hard to apply; this is generally believed to be due to the expressiveness limitations of the linearity discipline. It is now well understood that a linearity discipline must be complemented with a way of relaxing it through some controlled form of copying (e.g. borrowing).

"Functional-but-in-place" (FBIP) programming [START_REF] Reinking | Perceus: Garbage Free Reference Counting with Reuse[END_REF] is a variant of linear allocation with re-use, which achieves such mixing of linearity of copying by using reference counting, in a context that can accommodate the known drawbacks of the latter. (Linearity is detected dynamically using the reference count, rather than statically.) It should be possible instead to use regular tracing GC to express copying, which requires to understand how linear allocation interacts with a GC (at the level of types, but also at the machine level).

One crucial aspect seems to be the ability to treat the borrowing of linearly-allocated data structures as a homomorphism (the borrow of a list is isomorphic to a list of borrows, etc.). This polymorphism of borrowed objects can be seen at work with 13 See Leo White (2020), "Add raw_data primitives to avoid naked pointers" ocaml/ocaml#9910 14 For static allocation, i.e. without deallocation, other tricks have been proposed

to support it without a page table.

the Ancient library, in the way Ancient-allocated data structures can be conveniently manipulated using usual OCaml code, and mixed with usual OCaml data structures. Such isomorphisms are also suggested by an abstract model of ownership [START_REF] Combette | A resource modality for RAII[END_REF] This was tedious and time-consuming, I stopped half-way through.

I have reported some to their author as time permitted, in which case they have been fixed since.

C. Example of static data usage

I instrumented the OCaml runtime to record data about the static data visited during marking. Figure 1 compares the amount of values skipped thanks to the page table to the total number of values seen by the GC when running OCaml (to compile the Coq proof assistant) and the Coq proof assistant (to compile its standard library and various libraries from the Mathcomp project).

Figure

  Figure 1: coq_mathcomp_no_native

Some opam libraries using naked pointers (as of August 2018)

  . It relies on leveraging the notion of sharing from functional programming in a new way, and for this reason it is not (yet) seen in languages such as Rust. This resource polymorphism, whereby code operate on data indifferently of the way the latter has been allocated, is, for me, what motivates the page table, prior to efficiency concerns, compared to any proposed alternative ways of handling out-of-heap pointers.

	Source:	https://gitlab.com/gadmm/stdlib-experiment/-
	/blob/master/other/async_audit/value (subject to analysis
	and transcription error).
	• curses		• ladspa
	• dssi		• lutin
	• ezsqlite		• mm
	• flow_parser	• ocamlsdl
	• flowtype		• odbc
	• gles3		• offheap
	• glfw-ocaml	• rdbg
	• glMLite		• spf
	• glsurf		• sqlite3
	• grib		• sundialsml
	• hiredis		• tuntap
	• lablgl		• utp
	• lablgtk3		• vhd-tool
	• lablgtk3-gtkspell	• xen-gnt

B.

Stephen Dolan (2021), "Speed up GC by prefetching during marking" ocaml/ocaml#10195

At the time of the experiment, OCaml 4.12 was the latest stable version of OCaml, and the prefetching patch had not been merged yet. In addition, it was not possible to work directly with the multicore branch since it lacks prefetching (still at the time of writing this paper).

One that limits the way minor heaps can be allocated in order to test quickly whether a value is young, and does an expensive test to distinguish code pointers in the bytecode interpreter.

One hypothesis is that an optimisation turned out to be a pessimisation. Fixing this would-be pessimisation improved the performance comparably to the new page table. An analysis in terms of costs of branch mispredictions was consistent with the effect.

This is unfortunately not the case with the OCaml 5.0 allocator, which does not use the system allocator in the same way.

Thanks to Pierre-Marie Pédrot and Ralf Jung for running Coq benchmarks on my branches.

Florent Monnier, "How to wrap C functions to OCaml", 2007-2020, https://web.archive.org/web/20200223115730/http://www.linuxnantes.org:80/∼fmonnier/OCaml/ocaml-wrapping-c.html (an updated version which no longer advocates the use of naked pointers is available at http://decapode314.free.fr/ocaml/ocaml-wrapping-c.html)

8 At least until 2020 on the website http://ocaml.org and in the popular book Real World OCaml (https://www.realworldocaml.org/).

Several sources advertise the OCaml language as an "industrial-strength" language, or even a "systems" programming language.

 10 For some practical reasons, this behaviour is not desirable as a

default. 11 Some whose fix is still pending as of September 2022, such as the LLVM bindings and native_compute in the Coq proof

assistant.12 An interesting example of the usefulness of having a value different from every valid OCaml value has been given, but the examples actually found in the wild were much less interesting.