Skip to content

Commit

Permalink
Minimum compiler version update (tgstation#59771)
Browse files Browse the repository at this point in the history
Updates the minimum compiler version to 514.1556
Additionally implements `as anything` in parts that requested it with a warning
  • Loading branch information
Watermelon914 authored Jun 23, 2021
1 parent 105222c commit d42bf33
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 124 deletions.
Binary file removed byond-extools.dll
Binary file not shown.
5 changes: 0 additions & 5 deletions code/__DEFINES/_tick.dm
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
/// Percentage of tick to leave for master controller to run
#define MAPTICK_MC_MIN_RESERVE 70
/// internal_tick_usage is updated every tick by extools
#if defined(USE_EXTOOLS) || DM_VERSION < 514
#define MAPTICK_LAST_INTERNAL_TICK_USAGE ((GLOB.internal_tick_usage / world.tick_lag) * 100)
#else
#define MAPTICK_LAST_INTERNAL_TICK_USAGE (world.map_cpu)
#endif

/// Tick limit while running normally
#define TICK_BYOND_RESERVE 2
Expand Down
17 changes: 4 additions & 13 deletions code/_compile_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,12 @@
#endif

//Update this whenever you need to take advantage of more recent byond features
#define MIN_COMPILER_VERSION 513
#define MIN_COMPILER_BUILD 1514
#if DM_VERSION < MIN_COMPILER_VERSION || DM_BUILD < MIN_COMPILER_BUILD
#define MIN_COMPILER_VERSION 514
#define MIN_COMPILER_BUILD 1556
#if (DM_VERSION < MIN_COMPILER_VERSION || DM_BUILD < MIN_COMPILER_BUILD) && !defined(SPACEMAN_DMM)
//Don't forget to update this part
#error Your version of BYOND is too out-of-date to compile this project. Go to https://secure.byond.com/download and update.
#error You need version 513.1514 or higher
#endif

//Don't load extools on 514 and 513.1539+
#if DM_VERSION < 514 && DM_BUILD < 1540
#define USE_EXTOOLS
#endif
//Log the full sendmaps profile on 514.1556+, any earlier and we get bugs or it not existing
#if DM_VERSION >= 514 && DM_BUILD >= 1556
#define SENDMAPS_PROFILE
#error You need version 514.1556 or higher
#endif

//Additional code for the above flags.
Expand Down
30 changes: 2 additions & 28 deletions code/controllers/subsystem/profiler.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#define PROFILER_FILENAME "profiler.json"

#ifdef SENDMAPS_PROFILE
#define SENDMAPS_FILENAME "sendmaps.json"
GLOBAL_REAL_VAR(world_init_maptick_profiler) = world.Profile(PROFILE_RESTART, type = "sendmaps")
#endif


SUBSYSTEM_DEF(profiler)
name = "Profiler"
Expand Down Expand Up @@ -32,41 +30,22 @@ SUBSYSTEM_DEF(profiler)
/datum/controller/subsystem/profiler/Shutdown()
if(CONFIG_GET(flag/auto_profile))
DumpFile()
#ifdef SENDMAPS_PROFILE
world.Profile(PROFILE_CLEAR, type = "sendmaps")
#endif
return ..()

/datum/controller/subsystem/profiler/proc/StartProfiling()
#if DM_BUILD < 1506
stack_trace("Auto profiling unsupported on this byond version")
CONFIG_SET(flag/auto_profile, FALSE)
#else
world.Profile(PROFILE_START)
#ifdef SENDMAPS_PROFILE
world.Profile(PROFILE_START, type = "sendmaps")
#endif

#endif

/datum/controller/subsystem/profiler/proc/StopProfiling()
#if DM_BUILD >= 1506
world.Profile(PROFILE_STOP)
#ifdef SENDMAPS_PROFILE
world.Profile(PROFILE_STOP, type = "sendmaps")
#endif
#endif


/datum/controller/subsystem/profiler/proc/DumpFile()
#if DM_BUILD < 1506
stack_trace("Auto profiling unsupported on this byond version")
CONFIG_SET(flag/auto_profile, FALSE)
#else
var/timer = TICK_USAGE_REAL
var/current_profile_data = world.Profile(PROFILE_REFRESH, format = "json")
#ifdef SENDMAPS_PROFILE
var/current_sendmaps_data = world.Profile(PROFILE_REFRESH, type = "sendmaps", format="json")
#endif
fetch_cost = MC_AVERAGE(fetch_cost, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
CHECK_TICK

Expand All @@ -75,18 +54,13 @@ SUBSYSTEM_DEF(profiler)
var/prof_file = file("[GLOB.log_directory]/[PROFILER_FILENAME]")
if(fexists(prof_file))
fdel(prof_file)
#ifdef SENDMAPS_PROFILE
if(!length(current_sendmaps_data)) //Would be nice to have explicit proc to check this
stack_trace("Warning, sendmaps profiling stopped manually before dump.")
var/sendmaps_file = file("[GLOB.log_directory]/[SENDMAPS_FILENAME]")
if(fexists(sendmaps_file))
fdel(sendmaps_file)
#endif

timer = TICK_USAGE_REAL
WRITE_FILE(prof_file, current_profile_data)
#ifdef SENDMAPS_PROFILE
WRITE_FILE(sendmaps_file, current_sendmaps_data)
#endif
write_cost = MC_AVERAGE(write_cost, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
#endif
17 changes: 1 addition & 16 deletions code/controllers/subsystem/time_track.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ SUBSYSTEM_DEF(time_track)
var/last_tick_realtime = 0
var/last_tick_byond_time = 0
var/last_tick_tickcount = 0
#ifdef SENDMAPS_PROFILE
var/list/sendmaps_names_map = list(
"SendMaps" = "send_maps",
"SendMaps: Initial housekeeping" = "initial_house",
Expand All @@ -41,19 +40,16 @@ SUBSYSTEM_DEF(time_track)
"SendMaps: Per client: Map data: Look for movable changes: Loop through turfs in range" = "turfs_in_range",
"SendMaps: Per client: Map data: Look for movable changes: Movables examined" = "movables_examined",
)
#endif

/datum/controller/subsystem/time_track/Initialize(start_timeofday)
. = ..()
GLOB.perf_log = "[GLOB.log_directory]/perf-[GLOB.round_id ? GLOB.round_id : "NULL"]-[SSmapping.config?.map_name].csv"
#ifdef SENDMAPS_PROFILE
world.Profile(PROFILE_RESTART, type = "sendmaps")
//Need to do the sendmaps stuff in its own file, since it works different then everything else
var/list/sendmaps_shorthands = list()
for(var/proper_name in sendmaps_names_map)
sendmaps_shorthands += sendmaps_names_map[proper_name]
sendmaps_shorthands += "[sendmaps_names_map[proper_name]]_count"
#endif
log_perf(
list(
"time",
Expand All @@ -80,13 +76,10 @@ SUBSYSTEM_DEF(time_track)
"all_queries",
"queries_active",
"queries_standby"
#ifdef SENDMAPS_PROFILE
) + sendmaps_shorthands
#else
)
#endif
)


/datum/controller/subsystem/time_track/fire()

var/current_realtime = REALTIMEOFDAY
Expand All @@ -108,7 +101,6 @@ SUBSYSTEM_DEF(time_track)
last_tick_byond_time = current_byondtime
last_tick_tickcount = current_tickcount

#ifdef SENDMAPS_PROFILE
var/sendmaps_json = world.Profile(PROFILE_REFRESH, type = "sendmaps", format="json")
var/list/send_maps_data = json_decode(sendmaps_json)
var/send_maps_sort = send_maps_data.Copy() //Doing it like this guarentees us a properly sorted list
Expand All @@ -120,7 +112,6 @@ SUBSYSTEM_DEF(time_track)
for(var/list/packet in send_maps_sort)
send_maps_values += packet["value"]
send_maps_values += packet["calls"]
#endif

SSblackbox.record_feedback("associative", "time_dilation_current", 1, list("[SQLtime()]" = list("current" = "[time_dilation_current]", "avg_fast" = "[time_dilation_avg_fast]", "avg" = "[time_dilation_avg]", "avg_slow" = "[time_dilation_avg_slow]")))
log_perf(
Expand Down Expand Up @@ -149,16 +140,11 @@ SUBSYSTEM_DEF(time_track)
SSdbcore.all_queries_num,
SSdbcore.queries_active_num,
SSdbcore.queries_standby_num
#ifdef SENDMAPS_PROFILE
) + send_maps_values
#else
)
#endif
)

SSdbcore.reset_tracking()

#ifdef SENDMAPS_PROFILE
/datum/controller/subsystem/time_track/proc/scream_maptick_data()
var/current_profile_data = world.Profile(PROFILE_REFRESH, type = "sendmaps", format="json")
log_world(current_profile_data)
Expand All @@ -168,4 +154,3 @@ SUBSYSTEM_DEF(time_track)
output += "[entry["name"]],[entry["value"]],[entry["calls"]]\n"
log_world(output)
return output
#endif
6 changes: 1 addition & 5 deletions code/game/machinery/cryopod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,7 @@ GLOBAL_LIST_EMPTY(cryopod_computers)

visible_message(span_notice("[src] hums and hisses as it moves [mob_occupant.real_name] into storage."))

#if MIN_COMPILER_VERSION >= 514
#warn Please replace the loop below this warning with an `as anything` loop.
#endif
for(var/mob_content in mob_occupant)
var/obj/item/item_content = mob_content
for(var/obj/item/item_content as anything in mob_occupant)
if(!istype(item_content) || HAS_TRAIT(item_content, TRAIT_NODROP))
continue

Expand Down
10 changes: 2 additions & 8 deletions code/game/objects/items/RCD.dm
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,8 @@ GLOBAL_VAR_INIT(icon_holographic_window, init_holographic_window())

var/skip_to_next_turf = FALSE

#if MIN_COMPILER_VERSION >= 514
#warn Please replace the loop below this warning with an `as anything` loop.
#endif

for (var/_content_of_turf in surrounding_turf.contents)
// `as anything` doesn't play well on 513 with special lists such as contents.
// When the minimum version is raised to 514, upgrade this to `as anything`.
var/atom/content_of_turf = _content_of_turf

for (var/atom/content_of_turf as anything in surrounding_turf.contents)
if (content_of_turf.density)
skip_to_next_turf = TRUE
break
Expand Down
5 changes: 0 additions & 5 deletions code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ GLOBAL_VAR(restart_counter)
* All atoms in both compiled and uncompiled maps are initialized()
*/
/world/New()
#ifdef USE_EXTOOLS
var/extools = world.GetConfig("env", "EXTOOLS_DLL") || (world.system_type == MS_WINDOWS ? "./byond-extools.dll" : "./libbyond-extools.so")
if (fexists(extools))
call(extools, "maptick_initialize")()
#endif
enable_debugger()

log_world("World loaded at [time_stamp()]!")
Expand Down
4 changes: 0 additions & 4 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,7 @@ GLOBAL_PROTECT(admin_verbs_debug)
/client/proc/export_dynamic_json,
/client/proc/run_dynamic_simulations,
#endif
#ifdef SENDMAPS_PROFILE
/client/proc/display_sendmaps,
#endif
/datum/admins/proc/create_or_modify_area,
/client/proc/check_timer_sources,
/client/proc/toggle_cdn,
Expand Down Expand Up @@ -815,10 +813,8 @@ GLOBAL_PROTECT(admin_verbs_hideable)
var/datum/admins/admin = GLOB.admin_datums[ckey]
admin?.associate(src)

#ifdef SENDMAPS_PROFILE
/client/proc/display_sendmaps()
set name = "Send Maps Profile"
set category = "Debug"

src << link("?debug=profile&type=sendmaps&window=test")
#endif
12 changes: 2 additions & 10 deletions code/modules/vehicles/motorized_wheelchair.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@

/obj/vehicle/ridden/wheelchair/motorized/obj_destruction(damage_flag)
var/turf/T = get_turf(src)
#if MIN_COMPILER_VERSION >= 514
#warn Please replace the loop below this warning with an `as anything` loop.
#endif
for(var/wheelchair_content in contents)
var/atom/movable/atom_content = wheelchair_content
for(var/atom/movable/atom_content as anything in contents)
atom_content.forceMove(T)
return ..()

Expand Down Expand Up @@ -120,11 +116,7 @@
new /obj/item/stack/rods(drop_location(), 8)
new /obj/item/stack/sheet/iron(drop_location(), 10)
var/turf/T = get_turf(src)
#if MIN_COMPILER_VERSION >= 514
#warn Please replace the loop below this warning with an `as anything` loop.
#endif
for(var/wheelchair_content in contents)
var/atom/movable/atom_content = wheelchair_content
for(var/atom/movable/atom_content as anything in contents)
atom_content.forceMove(T)
qdel(src)
return TRUE
Expand Down
5 changes: 1 addition & 4 deletions dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# byond version
export BYOND_MAJOR=514
export BYOND_MINOR=1554
export BYOND_MINOR=1556

#rust_g git tag
export RUST_G_VERSION=0.4.7
Expand All @@ -17,8 +17,5 @@ export NODE_VERSION_PRECISE=12.20.0
# SpacemanDMM git tag
export SPACEMAN_DMM_VERSION=suite-1.7

# Extools git tag
export EXTOOLS_VERSION=v0.0.7

# Python version for mapmerge and other tools
export PYTHON_VERSION=3.6.8
26 changes: 0 additions & 26 deletions tools/tgs4_scripts/PreCompile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,32 +66,6 @@ env PKG_CONFIG_ALLOW_CROSS=1 ~/.cargo/bin/cargo build --release --target=i686-un
mv target/i686-unknown-linux-gnu/release/librust_g.so "$1/librust_g.so"
cd ..

# get dependencies for extools
apt-get install -y cmake build-essential gcc-multilib g++-multilib cmake wget

# update extools
if [ ! -d "extools" ]; then
echo "Cloning extools..."
git clone https://github.com/MCHSL/extools
cd extools/byond-extools
else
echo "Fetching extools..."
cd extools/byond-extools
git fetch
fi

echo "Deploying extools..."
git checkout "$EXTOOLS_VERSION"
if [ -d "build" ]; then
rm -R build
fi
mkdir build
cd build
cmake ..
make
mv libbyond-extools.so "$1/libbyond-extools.so"
cd ../../..

# install or update youtube-dl when not present, or if it is present with pip3,
# which we assume was used to install it
if ! [ -x "$has_youtubedl" ]; then
Expand Down

0 comments on commit d42bf33

Please sign in to comment.