Commit Graph

86 Commits

Author SHA1 Message Date
Masaaki Goshima 4c19a845d9 Support colored JSON 2021-06-01 03:09:47 +09:00
Masaaki Goshima 69cca05981 Pass RuntimeContext to the first argument of all append functions 2021-06-01 01:36:30 +09:00
Masaaki Goshima 11437c8556 Refactor escape string 2021-06-01 01:25:05 +09:00
Masaaki Goshima a56c080959 Refactor encode option 2021-05-31 22:25:33 +09:00
Masaaki Goshima 7cf15fc56c Fix opcode layout
- Adjust memory layout of the opcode to 128 bytes in a 64-bit environment
2021-05-29 14:47:18 +09:00
Masaaki Goshima aee5d8a6fb Refactor Debug mode for encoding 2021-05-18 14:48:13 +09:00
Masaaki Goshima 7ae14cd24c Optimize json.Compact and json.Indent 2021-04-20 20:12:32 +09:00
Masaaki Goshima 3d47fc9e41 Add debug mode 2021-03-27 12:18:19 +09:00
Masaaki Goshima 9cbe7b3991 Move encoder source to internal package 2021-03-18 15:46:55 +09:00
Masaaki Goshima cccf9f9f33 Replace vm and escaped vm codes with internal package 2021-03-17 12:32:23 +09:00
Masaaki Goshima 10c4118a45 Fix vm code 2021-03-17 00:22:19 +09:00
Masaaki Goshima c45f1e8b2c Add internal/vm package 2021-03-16 02:50:19 +09:00
Masaaki Goshima 2385cfcdbf Move rtype to internal/runtime package 2021-03-15 13:53:24 +09:00
Masaaki Goshima 4167aefe08 Fix any bugs of encoder
- fix some issues ( #104 #118 #144 #147 )
- fix recursive call operation
- use json.Number of encoding/json
- fix encoding of MarshalJSON and MarshalText
- fix pointer operation
- remove 'anonymous' and 'only' operation
- add test cases for array/slice/map/marshaler
2021-03-11 19:29:35 +09:00
Masaaki Goshima 2a0d4603ea Fix error output by golangci-lint 2021-02-01 22:32:45 +09:00
Masaaki Goshima 48b6fe21c6 Fix race error 2021-02-01 11:36:41 +09:00
Masaaki Goshima ffc954d356 Fix MarshalNoEscape 2021-01-31 22:53:01 +09:00
Masaaki Goshima 61e533dca2 Refactor encoder 2021-01-31 22:45:59 +09:00
Masaaki Goshima 90c2560b52 Fix accepatable address range 2021-01-31 02:30:48 +09:00
Masaaki Goshima a6ea71d2f6 Improve performance of lookup opcodeSet at encoding 2021-01-31 01:48:54 +09:00
Masaaki Goshima 182826fe68 Optimize encoding engine 2021-01-27 10:58:40 +09:00
Masaaki Goshima 689587cd72 Fix indent encoding 2021-01-25 00:06:16 +09:00
Masaaki Goshima 399354d64d Fix encoding runner interface 2021-01-24 15:17:39 +09:00
Masaaki Goshima ddfae9189e Fix recursive call 2021-01-15 16:28:20 +09:00
Masaaki Goshima 9c5f6ec0e6 Remove escaped optype 2021-01-11 19:21:30 +09:00
Masaaki Goshima 4cfb919183 Remove indent optype 2021-01-11 19:05:06 +09:00
Masaaki Goshima 06906637f2 Reduce memory usage at compile 2021-01-11 05:16:37 +09:00
Masaaki Goshima f06782ae9a Fix test 2020-12-30 19:39:20 +09:00
Masaaki Goshima b0b330a2dd Add noescape API for encoder 2020-12-30 19:32:38 +09:00
Masaaki Goshima 17f7434e93 Add optimized StructEnd operation to vm 2020-12-29 23:17:39 +09:00
Masaaki Goshima b8f43ca445 Optimize HTML escape operation 2020-12-25 22:26:59 +09:00
Masaaki Goshima 5741c733a6 Refactor indent code 2020-12-25 17:03:56 +09:00
Masaaki Goshima f5daa592fa Improve encoding performance 2020-12-25 03:53:48 +09:00
Masaaki Goshima 16309e2635 Refactor int encoding 2020-12-20 22:59:23 +09:00
Masaaki Goshima 9e97505584 Remove sync.Pool for encodeRuntimeContext 2020-12-20 20:09:41 +09:00
Masaaki Goshima d85327b458 Replace int/uint encoding implementation 2020-12-20 04:02:03 +09:00
Masaaki Goshima 01b439e41e Refactor buffering of encoder for improvement performance 2020-12-20 04:02:03 +09:00
Masaaki Goshima 6eb02f7ac0 Optimize access to opcodeMap 2020-12-15 14:46:10 +09:00
Cuong Manh Le 6b1d701387
Fix all invalid usages of unsafe.Pointer
Most of the invalid usages due to the conversion from uintptr to
unsafe.Pointer. In general, unsafe.Pointer(p) where p of type uintptr is
considered unsafe.

To fix that, use &p instead of p, then introduce another dereference.
Example, the invalid usage:

	*(*int)(unsafe.Pointer(p)) = int(v)

wil become:

	**(**int)(unsafe.Pointer(&p)) = int(v)

Closes #53
2020-11-16 20:37:12 +07:00
Masaaki Goshima 4994bc5d04 Fix handling of comma as delimiter
Conflicts:
	encode_vm.go
2020-11-16 19:16:45 +09:00
Masaaki Goshima d76012422a Fix stream encoding 2020-09-17 01:26:39 +09:00
Masaaki Goshima aaea586778 Enable switch map processing at runtime 2020-09-16 18:15:47 +09:00
Masaaki Goshima 92fb386db5 Optimize encoding for byteSlice type 2020-09-15 23:22:35 +09:00
Masaaki Goshima 2e7a990bbb Copy original opcode before caching 2020-09-15 20:47:41 +09:00
Masaaki Goshima 02e04238a2 Add keepRefs field 2020-09-04 20:28:27 +09:00
Masaaki Goshima f297c99af1 Remove unused arguments 2020-09-04 13:53:25 +09:00
Masaaki Goshima 18a6e4cffe Remove codePool 2020-09-01 22:39:20 +09:00
Masaaki Goshima 3aa921e884 Fix encoding engine 2020-09-01 22:26:26 +09:00
Masaaki Goshima 72bc598dd4 Remove state variables from opcode 2020-08-31 21:59:22 +09:00
Masaaki Goshima a6276c4d8e Optimize opcode.idx and seenPtr 2020-08-31 03:14:37 +09:00