Commit Graph

81 Commits

Author SHA1 Message Date
Behdad Esfahbod d5e1748f31 [cff] Simplify add_op() 2023-01-02 12:26:43 -07:00
Behdad Esfahbod d3ed6eed43 [cff] Initialize a member variable
For good hygiene.
2023-01-02 10:39:14 -07:00
Behdad Esfahbod 0ec0214f10 [cff-subset] Adjust pre-allocation
Reduces memory use significantly.
2022-12-31 13:19:38 -07:00
Behdad Esfahbod d480ae1fac [cff] Remove unused function 2022-11-24 13:53:43 -07:00
Behdad Esfahbod dcce53ddcb [cff] Micro-optimize fetch_op 2022-11-23 13:20:48 -07:00
Behdad Esfahbod 59c45f6deb Use hb_memcpy instead of memcpy consistently 2022-11-22 12:54:50 -07:00
Behdad Esfahbod 13e1ca9eb5 [cff] Micro-optimize memcpy 2022-11-22 12:19:28 -07:00
Behdad Esfahbod 28e767ddea [subset-cff] Really optimize op_str_t / parsed_cs_op_t layout
Now parsed_cs_op_t and op_str_t are both 16 bytes.

Saves another 7% in SourceHanSans/10000 benchmark.
2022-11-21 21:59:51 -07:00
Behdad Esfahbod 4f056b923a [subset-cff] Optimize op_str_t layout 2022-11-21 21:37:57 -07:00
Behdad Esfahbod dc3bb5e0ed [subset-cff] Pre-allocate values array for subroutines as well 2022-11-21 18:18:48 -07:00
Behdad Esfahbod 59451502e9 [cff] Optimize env error checking 2022-11-21 15:23:16 -07:00
Behdad Esfahbod d9de515a38 [cff] Optimize byte_str_ref_t array access 2022-11-21 14:23:07 -07:00
Behdad Esfahbod a81ec9b2b6 [cff] Optimize byte_str_ref_t inc()
Shows a couple percent speedup.
2022-11-21 14:03:28 -07:00
Behdad Esfahbod 6905d36d73 [cff] Fix fetch_op() bounds-checking 2022-11-21 10:51:33 -07:00
Behdad Esfahbod b51ab1a9e5 [cff] Optimize byte_str_ref_t
Make it 16 bytes instead of 24.  This struct is used in the subroutine
call stack heavily.

This change makes the HB AdobeVFPrototype benchmark to become faster
than FT one, with about 6% speedup as a result of this change.
2022-11-21 10:27:07 -07:00
Behdad Esfahbod 7a39464b18 [cff] Hide members of byte_str_ref_t 2022-11-21 09:48:54 -07:00
Behdad Esfahbod 18141f0007 [cff] Move a sub_array call
No logic change.... I hope?!
2022-11-21 09:47:03 -07:00
Behdad Esfahbod f66415cdd1 [cff] Move initialization of a type to constructor 2022-11-21 09:40:16 -07:00
Behdad Esfahbod 602e0ca79d [cff] Minor restructure of struct
Surprisingly this shows tiny benchmark improvement consistently.
2022-05-16 10:14:34 -06:00
Behdad Esfahbod acdab17ed3 [cff] Cosmetic in parsed_values_t 2022-05-13 14:14:36 -06:00
Behdad Esfahbod f08537963b [cff-subset] Pre-alloc vector for operator decoding 2022-05-11 12:14:49 -06:00
Behdad Esfahbod bff78e6515 [cff] Convert interpretation environment to use constructor 2022-05-10 16:50:38 -06:00
Behdad Esfahbod 0a42410dc8 [cff2] Change extents/shape stack to be just a number
Do the blending immediately.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3559

Benchmark on AdobeVFPrototype shows 35% speedup. Now we're faster
than FreeType:

Benchmark                                                           Time             CPU      Time Old      Time New       CPU Old       CPU New
------------------------------------------------------------------------------------------------------------------------------------------------
BM_Font/glyph_extents/AdobeVFPrototype.otf/hb                    -0.3792         -0.3792          1584           983          1581           982
BM_Font/glyph_extents/AdobeVFPrototype.otf/ft                    +0.0228         +0.0224          1220          1248          1218          1245
BM_Font/glyph_extents/AdobeVFPrototype.otf/var/hb                -0.3513         -0.3518          1616          1048          1613          1046
BM_Font/glyph_extents/AdobeVFPrototype.otf/var/ft                +0.0172         +0.0169          1232          1254          1230          1251
2022-05-10 13:41:12 -06:00
Behdad Esfahbod 1b14d2ff13 [cff] Fix arg-stack peek() impl 2022-05-09 18:15:31 -06:00
Behdad Esfahbod 6106ef8c0f [cff] Tighten up arg-stack access 2022-05-09 18:15:11 -06:00
Behdad Esfahbod 8c616a6efe [cff] Allocate stack inline instead of using hb_vector_t
Speeds up glyph_extents and glyph_shape benchmarks for CFF by 10
to 16 percent!
2022-05-09 17:50:59 -06:00
Behdad Esfahbod c941ece60f [cff] Use using instead of typedef 2022-05-09 17:34:58 -06:00
Behdad Esfahbod 8aa54aaca2 [cff] Replace byte_str_t with hb_bytes_t use 2022-05-09 17:34:58 -06:00
Behdad Esfahbod fe1d85a55a [cff] Remove custom byte_str_t impl 2022-05-09 17:34:58 -06:00
Behdad Esfahbod fe783ac091 [cff] Remove op_str_t nop init/fini 2022-01-18 13:38:28 -07:00
Behdad Esfahbod 8d24ac2662 [cff] Remove init/fini from number_t 2022-01-18 13:14:42 -07:00
Behdad Esfahbod 6ef83c2c31 [vector] Remove .fini_deep() 2022-01-18 13:08:34 -07:00
Garret Rieger b14475d2ae [subset] further changes to serializer error handling.
- Rename enum type and enum members.
- in_errors() now returns true for any error having been set. hb-subset now looks for offset overflow only errors to divert to repacker.
- Added INT_OVERFLOW and ARRAY_OVERFLOW enum values.
2021-03-18 10:51:26 -07:00
Garret Rieger 73ed59f7a6 [subset] store errors in the serializer as a flag set.
Make check_assign/check_equal specify the type of error to set.
2021-03-17 15:58:34 -07:00
Ebrahim Byagowi 2be859d289 minor, replace nullptr checks with implicit ones 2020-04-21 00:30:34 +04:30
Ebrahim Byagowi 2dda6dd744 minor, tweak spacing
turn 8 spaces to tab, add space before Null/Crap
2020-04-20 16:18:29 +04:30
ariza 002f0e20c4 reimplment serialize_int using check_assign() 2020-02-28 14:21:58 +03:30
Ebrahim Byagowi 5179b96958 [cff] minor on number_t 2019-10-08 11:11:18 +03:30
Ebrahim Byagowi 9fea6b4dd4
[amalgam] Use it in cmake port and fix conflicts (#1812) 2019-07-05 18:46:41 +04:30
Ebrahim Byagowi 9db7ce73d7
minor style improve in hb-cff-interp-common.hh 2019-06-28 23:11:52 +04:30
Michiharu Ariza dd4c37529b silence MVC warnings 2019-04-18 10:38:57 -07:00
Behdad Esfahbod b986c6a321 [C++11] Remove IntType::set() in favor of operator= 2019-03-29 20:21:21 -07:00
Behdad Esfahbod 70a52d6bd8 Convert all other enum class consts to static constexpr
Fixes https://github.com/harfbuzz/harfbuzz/issues/1553
2019-01-22 12:17:26 +01:00
Behdad Esfahbod 380c3cffb9 Use enum for class constant 2019-01-22 10:51:20 +01:00
Behdad Esfahbod fa333e34d6 [vector] Remove static_array
Was good idea, but with C++ types with constructor/destructor, was getting in
the way as compiler was destructing those items where it was not desired.
Since C++ does not allow zero-sized arrays, just remove it...
2018-12-27 17:56:22 -05:00
Michiharu Ariza 29f0b6bce7 CFF renaming (#1507)
* reimplement ByteStr as byte_str_t based on hb_ubytes_t

Unuse start_embed<ByteStr>
Also renamed SubByteStr to byte_str_ref_t
More renaming to come

* substr renamed to str_ref in line with its type byte_str_ref_t

* uncamelize non-table struct names

* uncamelized non-struct types OpCode etc

* add byte_str_t copy ctor

* test

* test2

* undo tests

* fix bot failure

* undo the previous change

* fixed tabs, added inline

* Revert "fixed tabs, added inline"

This reverts commit 21163c30e9.

* fix tabs
2018-12-22 10:47:04 -05:00
Behdad Esfahbod 474a12058d [array/vector] Rename len to length 2018-12-21 18:53:01 -05:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Ebrahim Byagowi b2ebaa9afa Remove redundant 'inline' from methods (#1483) 2018-12-16 14:08:10 -05:00
Michiharu Ariza 2941208f1e [CFF] oss-fuzz issue 11690 ASSERT: substr.offset >= opStart (#1461)
* fix oss-fuzz 11690: substr.offset >= opStart

detect recursive subroutine call & handle as error

* fix build failure

* add minimized test case for oss-fuzz 11690

* removed asserts
2018-12-11 15:21:24 -05:00