From b794404333d44c419e08de40650316bac07e943c Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 22 Dec 2015 14:33:39 -0700 Subject: [PATCH] faster path for a procedure impersonator w/o wrapper proc Make the call path faster when an impersontor is present on a procedure only to add impersonator properties. --- racket/src/racket/src/schnapp.inc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/racket/src/racket/src/schnapp.inc b/racket/src/racket/src/schnapp.inc index a3d585406d..c0d1e7f26e 100644 --- a/racket/src/racket/src/schnapp.inc +++ b/racket/src/racket/src/schnapp.inc @@ -60,12 +60,19 @@ Scheme_Object *PRIM_APPLY_NAME(Scheme_Object *rator, t = _SCHEME_TYPE(rator); + if ((t == scheme_proc_chaperone_type) + && SCHEME_VECTORP(((Scheme_Chaperone *)rator)->redirects) + && (SCHEME_VEC_SIZE(((Scheme_Chaperone *)rator)->redirects) & 0x1)) { + if (SCHEME_FALSEP(SCHEME_VEC_ELS(((Scheme_Chaperone *)rator)->redirects)[0])) { + /* No redirection proc (i.e, chaperone is just for properties) */ + rator = ((Scheme_Chaperone *)rator)->prev; + t = _SCHEME_TYPE(rator); + } else + return scheme_apply_chaperone(rator, argc, argv, NULL, PRIM_CHECK_MULTI | (PRIM_CHECK_VALUE << 1)); + } + if (t == scheme_prim_type) { return PRIM_APPLY_NAME_FAST(rator, argc, argv); - } else if ((t == scheme_proc_chaperone_type) - && SCHEME_VECTORP(((Scheme_Chaperone *)rator)->redirects) - && (SCHEME_VEC_SIZE(((Scheme_Chaperone *)rator)->redirects) & 0x1)) { - return scheme_apply_chaperone(rator, argc, argv, NULL, PRIM_CHECK_MULTI | (PRIM_CHECK_VALUE << 1)); } }