aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/utils.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2017-04-11 15:05:51 +0200
committerRickard Green <[email protected]>2017-04-11 15:05:51 +0200
commit92a3b1a37182527d0bf8b6242d54e7fae6f4bbf9 (patch)
tree133119634987a6eeede055d644fe2f999ea3d318 /erts/emulator/beam/utils.c
parentb66834310f1d3f30a7b4d5c02753053d3f9d7ef8 (diff)
parent6520f78d4b878ff66adcf8d25de331d8ad06dd1d (diff)
downloadotp-92a3b1a37182527d0bf8b6242d54e7fae6f4bbf9.tar.gz
otp-92a3b1a37182527d0bf8b6242d54e7fae6f4bbf9.tar.bz2
otp-92a3b1a37182527d0bf8b6242d54e7fae6f4bbf9.zip
Merge branch 'rickard/pcre-8.40'
OTP-14331 * rickard/pcre-8.40: Update documentation Update README.pcre_update.md Stack guard for PCRE Adjust for incompatibility between PCRE 8.40 and perl 5.22.1 Generate re replacement and split tests with perl vsn 5.22.1 Fix re_SUITE:pcre_compile_workspace_overflow/1 Skip line with lockout of modifiers in PCRE tests Update tests for PCRE version 8.40 Update PCRE to version 8.40 Conflicts: erts/emulator/beam/beam_debug.c
Diffstat (limited to 'erts/emulator/beam/utils.c')
-rw-r--r--erts/emulator/beam/utils.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c
index 092a5320ba..8f3f48f38f 100644
--- a/erts/emulator/beam/utils.c
+++ b/erts/emulator/beam/utils.c
@@ -4835,6 +4835,53 @@ Uint64 erts_timestamp_millis(void)
#endif
}
+void *
+erts_calc_stacklimit(char *prev_c, UWord stacksize)
+{
+ /*
+ * We *don't* want this function inlined, i.e., it is
+ * risky to call this function from another function
+ * in utils.c
+ */
+
+ UWord pagesize = erts_sys_get_page_size();
+ char c;
+ char *start;
+ if (&c > prev_c) {
+ start = (char *) ((((UWord) prev_c) / pagesize) * pagesize);
+ return (void *) (start + stacksize);
+ }
+ else {
+ start = (char *) (((((UWord) prev_c) - 1) / pagesize + 1) * pagesize);
+ return (void *) (start - stacksize);
+ }
+}
+
+/*
+ * erts_check_below_limit() and
+ * erts_check_above_limit() are put
+ * in utils.c in order to prevent
+ * inlining.
+ */
+
+int
+erts_check_below_limit(char *ptr, char *limit)
+{
+ return ptr < limit;
+}
+
+int
+erts_check_above_limit(char *ptr, char *limit)
+{
+ return ptr > limit;
+}
+
+void *
+erts_ptr_id(void *ptr)
+{
+ return ptr;
+}
+
#ifdef DEBUG
/*
* Handy functions when using a debugger - don't use in the code!