liquid5-c 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +164 -0
- data/ext/liquid_c/block.c +970 -0
- data/ext/liquid_c/block.h +37 -0
- data/ext/liquid_c/c_buffer.c +48 -0
- data/ext/liquid_c/c_buffer.h +82 -0
- data/ext/liquid_c/context.c +262 -0
- data/ext/liquid_c/context.h +72 -0
- data/ext/liquid_c/document_body.c +181 -0
- data/ext/liquid_c/document_body.h +84 -0
- data/ext/liquid_c/expression.c +130 -0
- data/ext/liquid_c/expression.h +24 -0
- data/ext/liquid_c/extconf.rb +60 -0
- data/ext/liquid_c/intutil.h +36 -0
- data/ext/liquid_c/lexer.c +172 -0
- data/ext/liquid_c/lexer.h +61 -0
- data/ext/liquid_c/liquid.c +182 -0
- data/ext/liquid_c/liquid.h +112 -0
- data/ext/liquid_c/liquid_vm.c +907 -0
- data/ext/liquid_c/liquid_vm.h +35 -0
- data/ext/liquid_c/mri_compat.h +35 -0
- data/ext/liquid_c/native_parser.c +2360 -0
- data/ext/liquid_c/native_value.c +49 -0
- data/ext/liquid_c/parse_context.c +84 -0
- data/ext/liquid_c/parse_context.h +13 -0
- data/ext/liquid_c/parser.c +285 -0
- data/ext/liquid_c/parser.h +25 -0
- data/ext/liquid_c/raw.c +136 -0
- data/ext/liquid_c/raw.h +6 -0
- data/ext/liquid_c/resource_limits.c +459 -0
- data/ext/liquid_c/resource_limits.h +28 -0
- data/ext/liquid_c/stringutil.h +37 -0
- data/ext/liquid_c/tokenizer.c +326 -0
- data/ext/liquid_c/tokenizer.h +46 -0
- data/ext/liquid_c/usage.c +18 -0
- data/ext/liquid_c/usage.h +9 -0
- data/ext/liquid_c/variable.c +198 -0
- data/ext/liquid_c/variable.h +61 -0
- data/ext/liquid_c/variable_lookup.c +73 -0
- data/ext/liquid_c/variable_lookup.h +8 -0
- data/ext/liquid_c/vm_assembler.c +631 -0
- data/ext/liquid_c/vm_assembler.h +294 -0
- data/ext/liquid_c/vm_assembler_pool.c +117 -0
- data/ext/liquid_c/vm_assembler_pool.h +27 -0
- data/lib/liquid/c/compile_ext.rb +47 -0
- data/lib/liquid/c/native_compiler.rb +262 -0
- data/lib/liquid/c/native_parser.rb +261 -0
- data/lib/liquid/c/native_tags.rb +103 -0
- data/lib/liquid/c/native_values.rb +9 -0
- data/lib/liquid/c/version.rb +7 -0
- data/lib/liquid/c.rb +379 -0
- metadata +140 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#ifndef VM_H
|
|
2
|
+
#define VM_H
|
|
3
|
+
|
|
4
|
+
#include <ruby.h>
|
|
5
|
+
#include "block.h"
|
|
6
|
+
#include "vm_assembler.h"
|
|
7
|
+
#include "context.h"
|
|
8
|
+
|
|
9
|
+
typedef struct vm_variable_frame {
|
|
10
|
+
struct vm_variable_frame *previous;
|
|
11
|
+
VALUE variable;
|
|
12
|
+
const uint8_t *instructions;
|
|
13
|
+
const VALUE *constants;
|
|
14
|
+
const VALUE *nodelist;
|
|
15
|
+
size_t max_stack_size;
|
|
16
|
+
} vm_variable_frame_t;
|
|
17
|
+
|
|
18
|
+
typedef struct vm {
|
|
19
|
+
c_buffer_t stack;
|
|
20
|
+
bool invoking_filter;
|
|
21
|
+
unsigned long context_generation;
|
|
22
|
+
unsigned long context_revision;
|
|
23
|
+
vm_variable_frame_t *variable_frame;
|
|
24
|
+
context_t context;
|
|
25
|
+
} vm_t;
|
|
26
|
+
|
|
27
|
+
void liquid_define_vm(void);
|
|
28
|
+
vm_t *vm_cached_for_context(VALUE context);
|
|
29
|
+
vm_t *vm_from_context(VALUE context);
|
|
30
|
+
void liquid_vm_render(block_body_header_t *block, const VALUE *const_ptr, VALUE context, VALUE output, const VALUE *nodelist);
|
|
31
|
+
void liquid_vm_next_instruction(const uint8_t **ip_ptr);
|
|
32
|
+
bool liquid_vm_filtering(VALUE context);
|
|
33
|
+
VALUE liquid_vm_evaluate(VALUE context, vm_assembler_t *code);
|
|
34
|
+
|
|
35
|
+
#endif
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#ifndef LIQUID_MRI_COMPAT_H
|
|
2
|
+
#define LIQUID_MRI_COMPAT_H
|
|
3
|
+
|
|
4
|
+
#include <ruby.h>
|
|
5
|
+
#include <stdbool.h>
|
|
6
|
+
|
|
7
|
+
// extconf probes the running MRI before enabling these optional interfaces.
|
|
8
|
+
#ifdef HAVE_RB_CALLABLE_METHOD_ENTRY
|
|
9
|
+
struct rb_callable_method_entry_struct;
|
|
10
|
+
RUBY_EXTERN const struct rb_callable_method_entry_struct *rb_callable_method_entry(VALUE klass, ID method);
|
|
11
|
+
|
|
12
|
+
static inline VALUE liquid_method_entry(VALUE klass, ID method)
|
|
13
|
+
{
|
|
14
|
+
return (VALUE)rb_callable_method_entry(klass, method);
|
|
15
|
+
}
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#ifdef HAVE_RUBY_VM_EVENT_FLAGS
|
|
19
|
+
RUBY_EXTERN rb_event_flag_t ruby_vm_event_flags;
|
|
20
|
+
|
|
21
|
+
static inline bool liquid_vm_tracing(void)
|
|
22
|
+
{
|
|
23
|
+
return ruby_vm_event_flags != 0;
|
|
24
|
+
}
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
#ifdef HAVE_RB_HASH_COMPARE_BY_ID_P
|
|
28
|
+
RUBY_EXTERN VALUE rb_hash_compare_by_id_p(VALUE hash);
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
#if defined(HAVE_RB_CALLABLE_METHOD_ENTRY) && defined(HAVE_RUBY_VM_EVENT_FLAGS)
|
|
32
|
+
#define LIQUID_HAVE_GUARDED_COMPILER 1
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
#endif
|