-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dlopen,dlsym,dlcloseの追加。拡張ライブラリが作れるようになりました。
- Loading branch information
Showing
17 changed files
with
1,196 additions
and
947 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
==13176== Memcheck, a memory error detector | ||
==13176== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. | ||
==13176== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info | ||
==13176== Command: ./clover2 code/stack.clo | ||
==13176== | ||
==13176== Invalid read of size 1 | ||
==13176== at 0x9668630: __strcmp_sse2_unaligned (in /usr/lib64/libc-2.24.so) | ||
==13176== by 0x414517: get_native_method (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x40B823: invoke_method (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x40C48F: vm (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x41A37C: jit (jit_runtime.cpp:602) | ||
==13176== by 0x40B7D1: invoke_method (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x4113F5: call_finalize_method_on_free_object (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x411B52: free_object (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x413FF6: compaction (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x413958: heap_final (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x40719B: main (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== Address 0x99d4b10 is 0 bytes inside a block of size 21 free'd | ||
==13176== at 0x4C2ED4A: free (vg_replace_malloc.c:530) | ||
==13176== by 0x4146AD: native_method_final (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x407175: main (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== Block was alloc'd at | ||
==13176== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299) | ||
==13176== by 0x9654CF9: strdup (in /usr/lib64/libc-2.24.so) | ||
==13176== by 0x4075D5: xstrdup (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x414628: native_method_init (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x4070FD: main (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== | ||
==13176== Invalid read of size 1 | ||
==13176== at 0x4C31C54: strcmp (vg_replace_strmem.c:842) | ||
==13176== by 0x414517: get_native_method (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x40B823: invoke_method (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x40C48F: vm (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x41A37C: jit (jit_runtime.cpp:602) | ||
==13176== by 0x40B7D1: invoke_method (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x4113F5: call_finalize_method_on_free_object (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x411B52: free_object (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x413FF6: compaction (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x413958: heap_final (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x40719B: main (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== Address 0x99d4b11 is 1 bytes inside a block of size 21 free'd | ||
==13176== at 0x4C2ED4A: free (vg_replace_malloc.c:530) | ||
==13176== by 0x4146AD: native_method_final (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x407175: main (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== Block was alloc'd at | ||
==13176== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299) | ||
==13176== by 0x9654CF9: strdup (in /usr/lib64/libc-2.24.so) | ||
==13176== by 0x4075D5: xstrdup (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x414628: native_method_init (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== by 0x4070FD: main (in /home/ab25cq/repo/clover2/clover2) | ||
==13176== | ||
eval_file | ||
eval_file end | ||
1 | ||
2 | ||
3 | ||
4 | ||
a1 | ||
a2 | ||
a3 | ||
a4 | ||
a5 | ||
5 | ||
6 | ||
eval_file final end | ||
==13176== | ||
==13176== HEAP SUMMARY: | ||
==13176== in use at exit: 113,454 bytes in 726 blocks | ||
==13176== total heap usage: 4,528 allocs, 3,802 frees, 2,245,572 bytes allocated | ||
==13176== | ||
==13176== LEAK SUMMARY: | ||
==13176== definitely lost: 0 bytes in 0 blocks | ||
==13176== indirectly lost: 0 bytes in 0 blocks | ||
==13176== possibly lost: 0 bytes in 0 blocks | ||
==13176== still reachable: 113,454 bytes in 726 blocks | ||
==13176== suppressed: 0 bytes in 0 blocks | ||
==13176== Rerun with --leak-check=full to see details of leaked memory | ||
==13176== | ||
==13176== For counts of detected and suppressed errors, rerun with: -v | ||
==13176== ERROR SUMMARY: 21 errors from 2 contexts (suppressed: 0 from 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Clover.test("Clover2 extention test...", ExtTest.hello(123) == 246); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
class ExtTest | ||
{ | ||
def hello(param:int): native static int; | ||
|
||
def initialize():static { | ||
dlib:pointer = System.dlopen("libExtTest.so", System.RTLD_LAZY); | ||
|
||
hello_method:pointer = System.dlsym(dlib, "ExtTest_hello"); | ||
|
||
System.put_fun_to_hash_for_native_method("ExtTest.hello(int)", "ExtTest_hello", hello_method); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "common.h" | ||
|
||
BOOL ExtTest_hello(CLVALUE** stack_ptr, CLVALUE* lvar, sVMInfo* info) | ||
{ | ||
CLVALUE* num = lvar; | ||
|
||
int num_value = num->mIntValue; | ||
|
||
printf("HELLO CLOVER2 EXTENSION %d\n", num_value); | ||
|
||
(*stack_ptr)->mIntValue = num_value * 2; | ||
(*stack_ptr)++; | ||
|
||
return TRUE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.