Skip to content

Commit 499d8f9

Browse files
committed
Remove src/main/c/cext/wrappers.c
* It was only used for --cext-sulong which is no longer supported. * It actually prevents the previous commit to work correctly.
1 parent 812b1a9 commit 499d8f9

File tree

3 files changed

+25
-39
lines changed

3 files changed

+25
-39
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ src/main/c/*/Makefile
4848
!src/main/c/truffleposix/Makefile
4949
!src/main/c/yarp/Makefile
5050
src/main/c/cext-trampoline/trampoline.c
51-
src/main/c/cext/wrappers.c
5251
src/main/c/etc/constdefs.h
5352
src/main/c/spawn-helper/spawn-helper
5453
src/main/c/debug

src/main/c/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ all: $(TRAMPOLINE) $(LIBTRUFFLERUBY) openssl/openssl.$(DLEXT) zlib/zlib.$(DLEXT)
4343
clean: clean_cexts clean_trampoline
4444

4545
clean_trampoline:
46-
$(Q) rm -f $(TRAMPOLINE) cext-trampoline/trampoline.c cext/wrappers.c cext-trampoline/*.o
46+
$(Q) rm -f $(TRAMPOLINE) cext-trampoline/trampoline.c cext-trampoline/*.o
4747

4848
clean_cexts:
4949
$(Q) rm -f cext/Makefile cext/*.o $(LIBTRUFFLERUBY)

tool/generate-cext-trampoline.rb

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
functions = []
4949

5050
Dir["src/main/c/cext/*.c"].sort.each do |file|
51-
next if %w[cext_constants.c wrappers.c ruby.c st.c strlcpy.c].include?(File.basename(file))
51+
next if %w[cext_constants.c ruby.c st.c strlcpy.c].include?(File.basename(file))
5252

5353
contents = File.read(file)
5454
found_functions = contents.scan(function_regexp)
@@ -128,37 +128,31 @@ def struct_by_value?(type)
128128
129129
C
130130

131-
File.open("src/main/c/cext/wrappers.c", "w") do |sulong|
132-
sulong.puts <<C
133-
#include <ruby.h>
134-
135-
C
136-
137-
signatures = [
138-
['rb_tr_setjmp_wrapper_void_to_void', '(void):void'],
139-
['rb_tr_setjmp_wrapper_pointer1_to_void', '(VALUE arg):void'],
140-
['rb_tr_setjmp_wrapper_pointer2_to_void', '(VALUE tracepoint, void *data):void'],
141-
['rb_tr_setjmp_wrapper_pointer3_to_void', '(VALUE val, ID id, VALUE *data):void'],
142-
['rb_tr_setjmp_wrapper_pointer3_to_int', '(VALUE key, VALUE val, VALUE arg):int'],
143-
['rb_tr_setjmp_wrapper_pointer1_to_size_t', '(const void *arg):size_t'],
144-
['rb_tr_setjmp_wrapper_int_pointer2_to_pointer', '(int argc, VALUE *argv, VALUE obj):VALUE'],
145-
['rb_tr_setjmp_wrapper_pointer2_int_to_pointer', '(VALUE g, VALUE h, int r):VALUE'],
146-
['rb_tr_setjmp_wrapper_pointer2_int_pointer2_to_pointer', '(VALUE yielded_arg, VALUE callback_arg, int argc, const VALUE *argv, VALUE blockarg):VALUE'],
131+
signatures = [
132+
['rb_tr_setjmp_wrapper_void_to_void', '(void):void'],
133+
['rb_tr_setjmp_wrapper_pointer1_to_void', '(VALUE arg):void'],
134+
['rb_tr_setjmp_wrapper_pointer2_to_void', '(VALUE tracepoint, void *data):void'],
135+
['rb_tr_setjmp_wrapper_pointer3_to_void', '(VALUE val, ID id, VALUE *data):void'],
136+
['rb_tr_setjmp_wrapper_pointer3_to_int', '(VALUE key, VALUE val, VALUE arg):int'],
137+
['rb_tr_setjmp_wrapper_pointer1_to_size_t', '(const void *arg):size_t'],
138+
['rb_tr_setjmp_wrapper_int_pointer2_to_pointer', '(int argc, VALUE *argv, VALUE obj):VALUE'],
139+
['rb_tr_setjmp_wrapper_pointer2_int_to_pointer', '(VALUE g, VALUE h, int r):VALUE'],
140+
['rb_tr_setjmp_wrapper_pointer2_int_pointer2_to_pointer', '(VALUE yielded_arg, VALUE callback_arg, int argc, const VALUE *argv, VALUE blockarg):VALUE'],
141+
]
142+
(1..16).each do |arity|
143+
signatures << [
144+
"rb_tr_setjmp_wrapper_pointer#{arity}_to_pointer",
145+
"(#{(1..arity).map { |i| "VALUE arg#{i}" }.join(', ')}):VALUE"
147146
]
148-
(1..16).each do |arity|
149-
signatures << [
150-
"rb_tr_setjmp_wrapper_pointer#{arity}_to_pointer",
151-
"(#{(1..arity).map { |i| "VALUE arg#{i}" }.join(', ')}):VALUE"
152-
]
153-
end
147+
end
154148

155-
signatures.each do |function_name, signature|
156-
argument_types, return_type = signature.split(':')
157-
argument_types = argument_types.delete_prefix('(').delete_suffix(')')
158-
original_argument_types = argument_types
159-
argument_types = '' if argument_types == 'void'
160-
void = return_type == 'void'
161-
f.puts <<C
149+
signatures.each do |function_name, signature|
150+
argument_types, return_type = signature.split(':')
151+
argument_types = argument_types.delete_prefix('(').delete_suffix(')')
152+
original_argument_types = argument_types
153+
argument_types = '' if argument_types == 'void'
154+
void = return_type == 'void'
155+
f.puts <<C
162156
#{return_type} #{function_name}(#{return_type} (*func)(#{original_argument_types})#{', ' unless argument_types.empty?}#{argument_types}) {
163157
#{"#{return_type} result;" unless void}
164158
@@ -179,13 +173,6 @@ def struct_by_value?(type)
179173
}
180174
181175
C
182-
sulong.puts <<C
183-
#{return_type} #{function_name}(#{return_type} (*func)(#{original_argument_types})#{', ' unless argument_types.empty?}#{argument_types}) {
184-
#{'return ' unless void}func(#{argument_types.split(', ').map { |param| param[/\w+$/] }.join(', ')});
185-
}
186-
187-
C
188-
end
189176
end
190177

191178
f.puts "\n// Functions\n\n"

0 commit comments

Comments
 (0)