Skip to content

Commit

Permalink
inline simple cu string access into exprjit template
Browse files Browse the repository at this point in the history
just like the MVM_STATIC_INLINE function we use to
get strings from a CU, we do a fast path for already
deserialized strings, which ought to be extremely
common.
  • Loading branch information
timo committed Apr 16, 2018
1 parent 161b476 commit 70ae7eb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/jit/core_templates.expr
Expand Up @@ -164,10 +164,7 @@


(template: sp_getstringfrom
(call (^func MVM_cu_string)
(arglist (carg (tc) ptr)
(carg (^spesh_slot_value $1) ptr)
(carg $2 int)) ptr_sz))
(^indirect_cu_string (^spesh_slot_value $1) $2))

(template: wval
(call (^func MVM_sc_get_sc_object)
Expand Down
11 changes: 8 additions & 3 deletions src/jit/macro.expr
Expand Up @@ -39,10 +39,15 @@


(macro: ^func (,a) (const (&CONST_PTR ,a) ptr_sz))
(macro: ^indirect_cu_string (,cu ,a)
(let: (($str (load (idx (^getf ,cu MVMCompUnit body.strings) ,a ptr_sz) ptr_sz)))
(if (nz $str) $str
(call (^func MVM_cu_string)
(arglist (carg (tc) ptr) (carg ,cu ptr) (carg ,a int))
ptr_sz))))

(macro: ^cu_string (,a)
(call (^func MVM_cu_string)
(arglist (carg (tc) ptr) (carg (cu) ptr) (carg ,a int))
ptr_sz))
(^indirect_cu_string (cu) ,a))

(macro: ^objflag (,cv) (const (&QUOTE ,cv) (&SIZEOF_MEMBER MVMObject header.flags)))

Expand Down

0 comments on commit 70ae7eb

Please sign in to comment.