Skip to content

Commit

Permalink
[MIRROR] Bumps compile to 515 [MDB IGNORE] (#25257) (#926)
Browse files Browse the repository at this point in the history
* Bumps compile to 515 (#79134)

## About The Pull Request

LSP supports it, let's GOOOOOO
I've removed the 515 tests since they're stable, alongside the libcall
wrapper. left the rustgcall wrapper cause yaknow memes
Just removed all the 515 and 514 particular define wrappers. gaming

## Changelog
:cl:
server: Minimum compile version has been bumped to 515. clients still
support 514 but we're gonna start using 515 restricted features for
serverside now.
/:cl:

---------



* Bumps compile to 515

* Fixes a TGS regression in its API

---------

Co-authored-by: SkyratBot <[email protected]>
Co-authored-by: LemonInTheDark <[email protected]>
Co-authored-by: John Willard <53777086+JohnFulpWillard@ users.noreply.github.com>
Co-authored-by: GoldenAlpharex <[email protected]>
  • Loading branch information
5 people authored Dec 4, 2023
1 parent 25f222c commit bfffddc
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 170 deletions.
2 changes: 0 additions & 2 deletions .github/alternate_byond_versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@
# Format is version: map
# Example:
# 500.1337: runtimestation

515.1603: runtimestation
2 changes: 1 addition & 1 deletion .tgs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
version: 1
# The BYOND version to use (kept in sync with dependencies.sh by the "TGS Test Suite" CI job)
# Must be interpreted as a string, keep quoted
byond: "514.1588"
byond: "515.1620"
# Folders to create in "<instance_path>/Configuration/GameStaticFiles/"
static_files:
# Config directory should be static
Expand Down
9 changes: 0 additions & 9 deletions code/__DEFINES/_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,8 @@
} \
sleep(time);

#ifdef EXPERIMENT_515_DONT_CACHE_REF
/// Takes a datum as input, returns its ref string
#define text_ref(datum) ref(datum)
#else
/// Takes a datum as input, returns its ref string, or a cached version of it
/// This allows us to cache \ref creation, which ensures it'll only ever happen once per datum, saving string tree time
/// It is slightly less optimal then a []'d datum, but the cost is massively outweighed by the potential savings
/// It will only work for datums mind, for datum reasons
/// : because of the embedded typecheck
#define text_ref(datum) (isdatum(datum) ? (datum:cached_ref ||= "\ref[datum]") : ("\ref[datum]"))
#endif

// Refs contain a type id within their string that can be used to identify byond types.
// Custom types that we define don't get a unique id, but this is useful for identifying
Expand Down
6 changes: 3 additions & 3 deletions code/__HELPERS/_auxtools_api.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GLOBAL_PROTECT(auxtools_initialized)
}\
if (GLOB.auxtools_initialized[LIB] != AUXTOOLS_FULL_INIT) {\
if (fexists(LIB)) {\
var/string = LIBCALL(LIB,"auxtools_init")();\
var/string = call_ext(LIB,"auxtools_init")();\
if(findtext(string, "SUCCESS")) {\
GLOB.auxtools_initialized[LIB] = AUXTOOLS_FULL_INIT;\
} else {\
Expand All @@ -23,13 +23,13 @@ GLOBAL_PROTECT(auxtools_initialized)

#define AUXTOOLS_SHUTDOWN(LIB)\
if (GLOB.auxtools_initialized[LIB] == AUXTOOLS_FULL_INIT && fexists(LIB)){\
LIBCALL(LIB,"auxtools_shutdown")();\
call_ext(LIB,"auxtools_shutdown")();\
GLOB.auxtools_initialized[LIB] = AUXTOOLS_PARTIAL_INIT;\
}\

#define AUXTOOLS_FULL_SHUTDOWN(LIB)\
if (GLOB.auxtools_initialized[LIB] && fexists(LIB)){\
LIBCALL(LIB,"auxtools_full_shutdown")();\
call_ext(LIB,"auxtools_full_shutdown")();\
GLOB.auxtools_initialized[LIB] = FALSE;\
}

Expand Down
4 changes: 0 additions & 4 deletions code/__HELPERS/nameof.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@
/**
* NAMEOF that actually works in static definitions because src::type requires src to be defined
*/
#if DM_VERSION >= 515
#define NAMEOF_STATIC(datum, X) (nameof(type::##X))
#else
#define NAMEOF_STATIC(datum, X) (#X || ##datum.##X)
#endif
48 changes: 6 additions & 42 deletions code/__byond_version_compat.dm
Original file line number Diff line number Diff line change
@@ -1,52 +1,21 @@
// This file contains defines allowing targeting byond versions newer than the supported

//Update this whenever you need to take advantage of more recent byond features
#define MIN_COMPILER_VERSION 514
#define MIN_COMPILER_BUILD 1556
#define MIN_COMPILER_VERSION 515
#define MIN_COMPILER_BUILD 1609
#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 514.1556 or higher
#endif

#if (DM_VERSION == 514 && DM_BUILD > 1575 && DM_BUILD <= 1577)
#error Your version of BYOND currently has a crashing issue that will prevent you from running Dream Daemon test servers.
#error We require developers to test their content, so an inability to test means we cannot allow the compile.
#error Please consider downgrading to 514.1575 or lower.
#error You need version 515.1609 or higher
#endif

// Keep savefile compatibilty at minimum supported level
#if DM_VERSION >= 515
/savefile/byond_version = MIN_COMPILER_VERSION
#endif

// 515 split call for external libraries into call_ext
#if DM_VERSION < 515
#define LIBCALL call
#else
#define LIBCALL call_ext
#endif

// So we want to have compile time guarantees these methods exist on local type, unfortunately 515 killed the .proc/procname and .verb/verbname syntax so we have to use nameof()
// So we want to have compile time guarantees these methods exist on local type
// We use wrappers for this in case some part of the api ever changes, and to make their function more clear
// For the record: GLOBAL_VERB_REF would be useless as verbs can't be global.

#if DM_VERSION < 515

/// Call by name proc references, checks if the proc exists on either this type or as a global proc.
#define PROC_REF(X) (.proc/##X)
/// Call by name verb references, checks if the verb exists on either this type or as a global verb.
#define VERB_REF(X) (.verb/##X)

/// Call by name proc reference, checks if the proc exists on either the given type or as a global proc
#define TYPE_PROC_REF(TYPE, X) (##TYPE.proc/##X)
/// Call by name verb reference, checks if the verb exists on either the given type or as a global verb
#define TYPE_VERB_REF(TYPE, X) (##TYPE.verb/##X)

/// Call by name proc reference, checks if the proc is an existing global proc
#define GLOBAL_PROC_REF(X) (/proc/##X)

#else

/// Call by name proc references, checks if the proc exists on either this type or as a global proc.
#define PROC_REF(X) (nameof(.proc/##X))
/// Call by name verb references, checks if the verb exists on either this type or as a global verb.
Expand All @@ -60,16 +29,11 @@
/// Call by name proc reference, checks if the proc is an existing global proc
#define GLOBAL_PROC_REF(X) (/proc/##X)

#endif

#if (DM_VERSION == 515)
/// fcopy will crash on 515 linux if given a non-existant file, instead of returning 0 like on 514 linux or 515 windows
/// var case matches documentation for fcopy.
/world/proc/__fcopy(Src, Dst)
if (istext(Src) && !fexists(Src))
return 0
return fcopy(Src, Dst)

#define fcopy(Src, Dst) world.__fcopy(Src, Dst)

#endif
#define fcopy(Src, Dst) world.__fcopy(Src, Dst)
30 changes: 9 additions & 21 deletions code/_experiments.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,20 @@
// Any flag you see here can be flipped with the `-D` CLI argument.
// For example, if you want to enable EXPERIMENT_MY_COOL_FEATURE, compile with -DEXPERIMENT_MY_COOL_FEATURE

// EXPERIMENT_515_QDEL_HARD_REFERENCE
// - Hold a hard reference for qdeleted items, and check ref_count, rather than using refs. Requires 515+.

// EXPERIMENT_515_DONT_CACHE_REF
// - Avoids `text_ref` caching, aided by improvements to ref() speed in 515.
// EXPERIMENT_MY_COOL_FEATURE
// - Does something really cool, just so neat, absolutely banging, gaming and chill

#if DM_VERSION < 515

// You can't X-macro custom names :(
#ifdef EXPERIMENT_515_QDEL_HARD_REFERENCE
#warn EXPERIMENT_515_QDEL_HARD_REFERENCE is only available on 515+
#undef EXPERIMENT_515_QDEL_HARD_REFERENCE
#endif

#ifdef EXPERIMENT_515_DONT_CACHE_REF
#warn EXPERIMENT_515_DONT_CACHE_REF is only available on 515+
#undef EXPERIMENT_515_DONT_CACHE_REF
#endif

// You can't X-macro custom names :(
#ifdef EXPERIMENT_MY_COOL_FEATURE
#warn EXPERIMENT_MY_COOL_FEATURE is only available on 515+
#undef EXPERIMENT_MY_COOL_FEATURE
#endif
#elif defined(UNIT_TESTS)

#define EXPERIMENT_515_QDEL_HARD_REFERENCE
#define EXPERIMENT_515_DONT_CACHE_REF

#define EXPERIMENT_MY_COOL_FEATURE
#endif

#if DM_VERSION >= 516
#error "Remove all 515 experiments"
#error "Remove all 515 experiments"
#endif
9 changes: 8 additions & 1 deletion code/controllers/globals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars)
GLOB = src

var/datum/controller/exclude_these = new
gvars_datum_in_built_vars = exclude_these.vars + list(NAMEOF(src, gvars_datum_protected_varlist), NAMEOF(src, gvars_datum_in_built_vars), NAMEOF(src, gvars_datum_init_order))
// I know this is dumb but the nested vars list hangs a ref to the datum. This fixes that
var/list/controller_vars = exclude_these.vars.Copy()
controller_vars["vars"] = null
gvars_datum_in_built_vars = controller_vars + list(NAMEOF(src, gvars_datum_protected_varlist), NAMEOF(src, gvars_datum_in_built_vars), NAMEOF(src, gvars_datum_init_order))

#if DM_VERSION >= 515 && DM_BUILD > 1620
#warn datum.vars hanging a ref should now be fixed, there should be no reason to remove the vars list from our controller's vars list anymore
#endif
QDEL_IN(exclude_these, 0) //signal logging isn't ready

Initialize()
Expand Down
37 changes: 6 additions & 31 deletions code/controllers/subsystem/garbage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,6 @@ SUBSYSTEM_DEF(garbage)
pass_counts[i] = 0
fail_counts[i] = 0

#ifdef EXPERIMENT_515_QDEL_HARD_REFERENCE
// 1 from the hard reference in the queue, and 1 from the variable used before this
#define IS_DELETED(datum, _) (refcount(##datum) == 2)
#else
#define IS_DELETED(datum, gcd_at_time) (isnull(##datum) || ##datum.gc_destroyed != gcd_at_time)
#endif

/datum/controller/subsystem/garbage/proc/HandleQueue(level = GC_QUEUE_FILTER)
if (level == GC_QUEUE_FILTER)
Expand All @@ -168,7 +162,7 @@ SUBSYSTEM_DEF(garbage)

lastlevel = level

//We do this rather then for(var/refID in queue) because that sort of for loop copies the whole list.
//We do this rather then for(var/list/ref_info in queue) because that sort of for loop copies the whole list.
//Normally this isn't expensive, but the gc queue can grow to 40k items, and that gets costly/causes overrun.
for (var/i in 1 to length(queue))
var/list/L = queue[i]
Expand All @@ -183,17 +177,11 @@ SUBSYSTEM_DEF(garbage)
break // Everything else is newer, skip them
count++

#ifdef EXPERIMENT_515_QDEL_HARD_REFERENCE
var/datum/D = L[GC_QUEUE_ITEM_REF]
#else
var/GCd_at_time = L[GC_QUEUE_ITEM_GCD_DESTROYED]

var/refID = L[GC_QUEUE_ITEM_REF]
var/datum/D
D = locate(refID)
#endif

if (IS_DELETED(D, GCd_at_time)) // So if something else coincidently gets the same ref, it's not deleted by mistake
// 1 from the hard reference in the queue, and 1 from the variable used before this
// If that's all we've got, send er off
if (refcount(D) == 2)
++gcedlasttick
++totalgcs
pass_counts[level]++
Expand Down Expand Up @@ -228,10 +216,9 @@ SUBSYSTEM_DEF(garbage)
var/datum/qdel_item/I = items[type]

var/message = "## TESTING: GC: -- [text_ref(D)] | [type] was unable to be GC'd --"
#if DM_VERSION >= 515
message = "[message] (ref count of [refcount(D)])"
#endif
log_world(message)

var/detail = D.dump_harddel_info()
if(detail)
LAZYADD(I.extra_details, detail)
Expand Down Expand Up @@ -270,8 +257,6 @@ SUBSYSTEM_DEF(garbage)
queue.Cut(1,count+1)
count = 0

#undef IS_DELETED

/datum/controller/subsystem/garbage/proc/Queue(datum/D, level = GC_QUEUE_FILTER)
if (isnull(D))
return
Expand All @@ -280,21 +265,11 @@ SUBSYSTEM_DEF(garbage)
return
var/queue_time = world.time

#ifdef EXPERIMENT_515_QDEL_HARD_REFERENCE
var/refid = D
if (D.gc_destroyed <= 0)
D.gc_destroyed = queue_time
#else
var/refid = text_ref(D)
var/static/uid = 0
if (D.gc_destroyed <= 0)
uid = WRAP(uid+1, 1, SHORT_REAL_LIMIT - 1)
D.gc_destroyed = uid
#endif

var/list/queue = queues[level]

queue[++queue.len] = list(queue_time, refid, D.gc_destroyed) // not += for byond reasons
queue[++queue.len] = list(queue_time, D, D.gc_destroyed) // not += for byond reasons

//this is mainly to separate things profile wise.
/datum/controller/subsystem/garbage/proc/HardDelete(datum/D)
Expand Down
12 changes: 0 additions & 12 deletions code/datums/callback.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@
if (!object)
return

#if DM_VERSION <= 514
if(istext(object) && object != GLOBAL_PROC)
to_chat(usr, "[object] may be an external library. Calling external libraries is disallowed.", confidential = TRUE)
return
#endif

var/list/calling_arguments = arguments
if (length(args))
if (length(arguments))
Expand Down Expand Up @@ -147,12 +141,6 @@
if (!object)
return

#if DM_VERSION <= 514
if(istext(object) && object != GLOBAL_PROC)
to_chat(usr, "[object] may be an external library. Calling external libraries is disallowed.", confidential = TRUE)
return
#endif

var/list/calling_arguments = arguments
if (length(args))
if (length(arguments))
Expand Down
7 changes: 0 additions & 7 deletions code/datums/datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@
/// Datum level flags
var/datum_flags = NONE

#ifndef EXPERIMENT_515_DONT_CACHE_REF
/// A cached version of our \ref
/// The brunt of \ref costs are in creating entries in the string tree (a tree of immutable strings)
/// This avoids doing that more then once per datum by ensuring ref strings always have a reference to them after they're first pulled
var/cached_ref
#endif

/// A weak reference to another datum
var/datum/weakref/weak_reference

Expand Down
6 changes: 0 additions & 6 deletions code/datums/json_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,9 @@ GENERAL_PROTECT_DATUM(/datum/json_savefile)
var/file_name = "[account_name ? "[account_name]_" : ""]preferences_[time2text(world.timeofday, "MMM_DD_YYYY_hh-mm-ss")].json"
var/temporary_file_storage = "data/preferences_export_working_directory/[file_name]"

#if DM_VERSION >= 515
if(!text2file(json_encode(tree, JSON_PRETTY_PRINT), temporary_file_storage))
tgui_alert(requester, "Failed to export preferences to JSON! You might need to try again later.", "Export Preferences JSON")
return
#else
if(!text2file(json_encode(tree), temporary_file_storage))
tgui_alert(requester, "Failed to export preferences to JSON! You might need to try again later.", "Export Preferences JSON")
return
#endif

var/exportable_json = file(temporary_file_storage)

Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ GLOBAL_LIST_EMPTY(objects_by_id_tag)
return

/mob/proc/set_machine(obj/O)
if(QDELETED(src) || QDELETED(O))
return
if(machine)
unset_machine()
machine = O
Expand Down
6 changes: 3 additions & 3 deletions code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ GLOBAL_VAR(restart_counter)
AUXTOOLS_FULL_SHUTDOWN(AUXLUA)
var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL")
if (debug_server)
LIBCALL(debug_server, "auxtools_shutdown")()
call_ext(debug_server, "auxtools_shutdown")()

/world/Del()
auxcleanup()
Expand Down Expand Up @@ -470,14 +470,14 @@ GLOBAL_VAR(restart_counter)
else
CRASH("Unsupported platform: [system_type]")

var/init_result = LIBCALL(library, "init")("block")
var/init_result = call_ext(library, "init")("block")
if (init_result != "0")
CRASH("Error initializing byond-tracy: [init_result]")

/world/proc/init_debugger()
var/dll = GetConfig("env", "AUXTOOLS_DEBUG_DLL")
if (dll)
LIBCALL(dll, "auxtools_init")()
call_ext(dll, "auxtools_init")()
enable_debugging()

/world/Profile(command, type, format)
Expand Down
2 changes: 0 additions & 2 deletions code/modules/admin/view_variables/reference_tracking.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@

var/starting_time = world.time

#if DM_VERSION >= 515
log_reftracker("Refcount for [type]: [refcount(src)]")
#endif

//Time to search the whole game for our ref
DoSearchVar(GLOB, "GLOB", search_time = starting_time) //globals
Expand Down
3 changes: 0 additions & 3 deletions code/modules/clothing/outfits/vv_outfit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
//Temporary/Internal stuff, do not copy these.
var/static/list/ignored_vars = list(
NAMEOF(item, animate_movement),
#ifndef EXPERIMENT_515_DONT_CACHE_REF
NAMEOF(item, cached_ref),
#endif
NAMEOF(item, datum_flags),
NAMEOF(item, fingerprintslast),
NAMEOF(item, layer),
Expand Down
Loading

0 comments on commit bfffddc

Please sign in to comment.